JavaScript Çë½Ì
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(),this.ClientID, " <script language=\"javascript\" type=\"text/javascript\"> if(confirm('ÐèÒªÖ±½ÓÌá½»Âð?')) {......} else{....} </script>" , false);
ÏÖÓÐÒ»¸ölable
µ±ÉÏÃæÓï¾äÖÐif³ÉÁ¢Ê±,ÏëÈÃlableµÄtextµÈÓÚ0
.....ºÅ²¿·ÖÔõôд?
JScript code:
document.getElementById("LableµÄID").innerText = "0";
ÒòΪ·þÎñÆ÷¿Ø¼þLable½âÎö³Éhtml´úÂ룬ÊÇ <span id="label_Id">labelµÄÖµ </span>
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), this.ClientID, " <script language=\"javascript\" type=\"text/javascript\"> if(confirm('ÐèÒªÖ±½ÓÌá½»Âð?')) {document.getElementById("btn_hide").innerText = "0";} else{document.getElementById("btn_hide").innerText = "0";} </script>", false);
ÌáʾÎÒÉÙ)ºÍ;
ÎÒ²»ÖªµÀÄÄÉÙÁË
"btn_hide"
¸Ä³É
\"btn_hide\"
Ïà¹ØÎÊ´ð£º
ÎÒÔÚºǫ́¶¨ÒåÁË£º
public string[] a;
²¢½«Æä¸³ÖµÁË¡£
È»ºóÔÚJavascriptÀïÃæÓÃalert(" <%=a[1]%>")µÄ·½·¨¿ÉÒÔÊä³öaÖеÄÈÎÒâÊý¾Ý£¬µ«ÊÇ
ÎÒ¶¨ÒåÁË
var w=new Array(); ......
ÔÚaspÖÐÓÐÔËÓÃAJAXµÄʱºò£¬ÎÒÔÚ·þÎñÆ÷¿Ø¼þÈ·¶¨°´Å¥µã»÷ºó´¦ÀíһЩÊÂÇ飬½ÓÏÂÀ´¾ÍÊÇÒªµ÷ÓÃǰ̨µÄJavaScriptµÄº¯Êý£¬ÔõôŪ
C# code:
button.Attributes.Add("onclick", "xx()");
ÒýÓÃ
C ......
Çë´ó¼Ò×¢Òâ¿´Çå³þÎÊÌâ,²»ÊÇÒ»°ãÍøÉÏÌÖÂÛµÄÎÊÌâ:
ÔÚindex.phpÖÐÒýÓÃjsÎļþ
<script src='index.js'> </script>
¶øÔÚindex.jsÖÐÊÇÔõÑùÒýÓÃindex.phpÖÐphpµÄ±äÁ¿µÄÖµµÄÄØ?
ÏÖÔÚÎÒ ......
javascript »òÕß Jsp ÈçºÎʵÏÖµ¯³ö±£´æÎļþ¶Ô»°¿òÄØ£¿ ÎÒÊÇ´òË㽫JspÒ³Ãæ»òµÃµ½µÄ²ÎÊý±£´æµ½±¾µØ¡£±ÈÈç˵£¬·þÎñÆ÷¶Ë·µ»ØÁËÒ»¸öxmlÎļþ£¬ÎÒÏë°ÑËüµÄÄÚÈݱ£´æÏÂÀ´£¬µ«Õâ²»ÊÇÏÂÔØ£¬¶øÊÇʹÓÃä¯ÀÀÆ÷ÔÚ±¾µØ´´½¨Ò»¸öÎļþ£¬½ ......
Çë½Ì....
°ÑJavaScriptÖ±½ÓдÔÚjspÒ³ÃæÖØµ÷ÓñȽϺÃÄØ »¹ÊǰÑJavaScriptд³É.jsÎļþ È»ºóÔÚjspÒ³ÃæÖе÷Óà ºÃÄØ
ÎªÊ²Ã´ÄØ
¸öÈ˾õµÃµ÷ÓñȽϺᣡ£¡£
°ÑJavaScriptд³É.jsÎļþ ÕâÑù±È½ÏºÃ~ ......