¼±£¬Çó½Ì´ó¼ÒÒ»¸öJavaScriptÎÊÌâ
ÎÒÏë×öµÄ¹¦ÄÜÊǵ¥»÷°´Å¥£¬È»ºó¾Í°Ñselect±êÇ©ÀïµÄoptionÈ«²¿Çå¿Õ¡£
ÒÔÏÂÊÇ´úÂ룺
JScript code:
<script language="javascript">
function remove(){
var nclass=document.getElementById("snclassid");
var op=nclass.getElementsByTagName("option");
for(i=0;i<nclass.options.length;i++){ //Óöµ½µÄÎÊÌâ´¦
nclass.removeChild(op[0]);
}
}
</script>
</head>
<body>
<select name="snclassid" id="snclassid" style="width:180px;">
<option name='1' value='1'>C#ÓïÑÔ</option>
<option name='1' value='2'>ASPÓïÑÔ</option>
<option name='1' value='3'>VBÓïÑÔ</option>
<option name='2' value='4'>Å·ÃÀÎÄѧ</option>
<option name='2' value='5'>ÑÇÖÞÎÄѧ</option>
<option name='3' value='6'>Êýѧ</option>
<option name='3' value='7'>ÎïÀí</option>
<option name='3' value='8'>¸ßµÈÊýѧ</option>
</select>
<input type="button" onclick="remove()" value="Çå¿Õ"/>
</body>
µ±ÎÒ°ÑÑ»·ÌåµÄÌõ¼þ¸Ä³É i <8 µÄʱºò £¬¾ÍÄÜÔËÐгöÎÒÏëÒªµÄЧ¹û£¬µ«Êǵ±ÎÒ¸Ä³É i <nclass.options.length µÄʱºò£¬ <option>±êÇ©¾ÍÇå¿Õ²»Í꣬ÎÒÕÒÁË°ëÌìÔÒòÒ²¸ã²»¶®£¬ÎÒÓà alert(nclass.options.length) µ¯³öµÄÖµÒ²ÊÇ8£¬µ
Ïà¹ØÎÊ´ð£º
Õâ¸ö±íµ¥µÄÊýÖµ²»Êǹ̶¨µÄ£¡µ±°´ÏÂÍ£Ö¹°´Å¥µÄʱºò×îÖÕµÄÊý×ֲŻáÍ£ÔÚÉÏÃ棡
ÎÒÏë°Ñ×îºóͣϵÄÊý×Ö´«ËÍ´«Ë͵½ÏÂÒ»¸öASPÒ³ÃæÉÏÈ¥£¡
²»ÏëʹÓÃlocation.href="mnn.asp?action="+ok1ÕâÑùµÄ·½Ê½´«Ë͹ýÈ¥
......
ÐèҪдһ¸öjs·½·¨£ºescKeyPress()¡£Õâ¸ö·½·¨ÓÃÓÚÄ£ÄⰴϼüÅÌÉϵÄESC¼ü£¬ÎÒÏÖÔÚÓÐÒ»¸öÄ£ÄâÊó±ê×ó¼üµ¥»÷µÄjs·½·¨£¬JScript code:
function doClick(linkId){
var fireOnThis = document.getElementB ......
ÿһÏÊÇJSÖеÄС¼¼ÇÉ£¬µ«Ê®·ÖµÄʵÓã¡
1.document.write(¡±"); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window-& ......
ÎÒÔÚºǫ́ÓÃC#±àдASP.NETÒ³Ã棬ͬʱҪÓÃJAVASCRIPTÀ´¿ØÖÆÌáʾ´°¿Ú£¬Èç
Response.Write(" <script language=javascript>confirm('È·¶¨ÒªÉ¾³ýÂð£¿') </script>");
ÎÒÒªÓÃconfirm( ......
<script type="text/javascript">
var name = "The Window";
¡¡¡¡ var object = {
¡¡¡¡¡¡¡¡name : "My Object",
¡¡¡¡¡¡¡¡getNameFunc : ......