javascript练习:8-13选择与改变事件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="javascript"> function strCon(str)//连接字符串 { if(str!="请选择") { form1.text.value = "你选择的是 "+str; } else { form1.text.value = ""; } } </script> </head> <body> <form name="form1" id="form1" method="post" action=""><!--表单--> <label> <textarea name="text" cols="50" rows="10" onselect="alert('你行复制吗?');"></textarea> <p> <select name="select1" onchange="strCon(this.value)"> <option value="请选择">请选择</option> <option value="北京">北京</option> <option value="广州">广州</option> <option value="上海">上海</option> </select> </p> </label> </form> </body> </html>