javascript Óë C# »¥Ïàµ÷ÓÃ
ºÜ¶àÈ˶¼ÏòÔÚ·þÎñÆ÷
¶Ëµ÷Óÿͻ§¶ËµÄº¯ÊýÀ´²Ù×÷£¬Ò²¾ÍÊÇÔÚaspÖе÷ÓÃjava
script½Å±¾ÖÐÒѾ¶¨ÒåºÃµÄ½Å±¾º¯Êý¡£¾¹ýÑо¿£¬·¢ÏÖÁËһЩÃãÇ¿µÄ·½·¨¡£
1.
ÓÃResponse.Write·½·¨Ð´Èë½Å±¾
±ÈÈçÔÚÄãµ¥»÷°´Å¥ºó£¬ÏȲÙ×÷Êý¾Ý¿â
£¬ÍêÁ˺óÏÔʾÒѾÍê³É£¬¿ÉÒÔÔÚ×îºóÏëµ÷Óõĵط½Ð´ÉÏ
Response.Write("<script type='text/javascript'>alert();</script>");
Õâ¸ö·½·¨ÓиöȱÏݾÍÊDz»Äܵ÷Óýű¾Îļþ
ÖÐ
µÄ×Ô¶¨ÒåµÄº¯Êý£¬Ö»Äܵ÷ÓÃÄÚ²¿º¯Êý£¬¾ßÌåµ÷ÓÃ×Ô¶¨ÒåµÄº¯ÊýÖ»ÄÜÔÚResponse.WriteдÉϺ¯Êý¶¨Ò壬±ÈÈç
Response.Write("<script type='text/javascript'>function
myfun(){...}</script>");
2.
ÓÃClientScriptÀද̬Ìí¼Ó½Å±¾
Ó÷¨ÈçÏ£ºÔÚÏëµ÷ÓÃij¸öjavascript½Å±¾º¯ÊýµÄµØ·½Ìí¼Ó´úÂ룬עÒâÒª±£Ö¤MyFunÒѾÔڽű¾ÎļþÖж¨Òå¹ýÁË¡£
ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>MyFun();</script>");
Õâ¸ö·½·¨±ÈResponse.Write¸ü·½±ãһЩ£¬¿ÉÒÔÖ±½Óµ÷Óýű¾ÎļþÖеÄ×Ô¶¨Ò庯Êý¡£
3.
ÆÕͨµÄÌí¼Ó¿Ø¼þµÄAttributesÊôÐÔ
¶ÔÓÚÆÕͨ°´Å¥¾ÍÊÇ£ºButton1.Attributes.Add("onclick","MyFun();");
Ö»ÄÜÔÚOnloadÖлòÀàËÆÓÚonloadµÄ³õʼ»¯¹ý³ÌÖÐÌí¼Ó²ÅÓÐЧ¡£¶øÇÒÊÇÏÈÖ´Ðнű¾º¯Êý£¬ÎÞ·¨¸Ä±äÖ´ÐÐ˳Ðò¡£
×¢Ò⣬ÒÔÉÏËùÓз½·¨ÖУ¬ºǫ́´úÂ붼²»ÄÜÓÐת»¯µ±Ç°Ò³µÄ´úÂ룬±ÈÈçRedirectµÈ£¬Òª°Ñתҳ´úÂë·ÅÔڽű¾ÀïÃæ
ÎÊ£º
1.
ÈçºÎÔÚ
JavaScript
·ÃÎÊ
C#
º¯Êý
?
2.
ÈçºÎÔÚ
JavaScript
·ÃÎÊ
C#
±äÁ¿
?
3.
ÈçºÎÔÚ
C#
ÖзÃÎÊ
JavaScript
µÄÒÑÓбäÁ¿
?
4.
ÈçºÎÔÚ
C#
ÖзÃÎÊ
JavaScript
º¯Êý
?
ÎÊÌâ
1
´ð°¸ÈçÏ£º
javaScript
º¯ÊýÖÐÖ´ÐÐ
C#
´úÂëÖеĺ¯Êý£º
·½·¨Ò»£º
1
¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈë
button_click
ÖÐ
;
2
¡¢ÔÚǰ̨дһ¸ö
js
º¯Êý£¬ÄÚÈÝΪ
doc
ument.getElementById("btn1").click();
3
¡¢ÔÚǰ̨»òºǫ́µ÷ÓÃ
js
º¯Êý£¬¼¤·¢
click
ʼþ£¬µÈÓÚ·ÃÎʺǫ́
c#
º¯Êý£»
·½·¨¶þ£º
1
¡¢º¯ÊýÉùÃ÷Ϊ
public
ºǫ́´úÂë
(
°Ñ
public
¸Ä³É
protected
Ò²¿ÉÒÔ
)
public string ss()
{
return("a");
}
2
¡¢ÔÚ
html
ÀïÓÃ
<%=fucntion()% >
¿ÉÒÔµ÷ÓÃ
ǰ̨½Å±¾
&l
Ïà¹ØÎĵµ£º
JavaScript¾ÍÕâô»ØÊÂ1£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”JavaScript”>
2: <!--
3: document.write(“Hello”);
4: // -->
5: </scri ......
ä¯ÀÀÆ÷ÒѾ¿´µ½µÄ¶«Î÷¶¼´æÔÚ»º´æÎļþ¼ÐÀï¡£
½Å±¾×¢ÊÍ: µ¥ÐÐ// ¶àÐÐ/*....*/
Æô¶¯Ê±ºò¼ÓÔØfunction() window.onload= function;
alert Ìáʾ¶Ô»°¿ò alert("ÌáʾÄÚÈÝ");
promptÌáʾÊäÈë¿òprompt("ÌáʾÄÚÈÝ","ĬÈÏÖµ")£»
JavaScriptÖض¨Ïò ÔÚ×°ÔØÒ³Ãæʱ£¬²»ÄÜÔÚ×°ÔØÍêÖ ......
ÐèÒªÁ˽âµÄHTML֪ʶ
±êÇ© table,tr,th,td
ÓÃÑ»·½øÐÐÖظ´²Ù×÷
for(;;){}
javascript×Ö·û´®
ÔÚjavascriptÖУ¬µÚÒ»¸ö×Ö·ûÔÚλÖÃ0ÉÏ¡£cat£¬cÔÚλÖÃ0ÉÏ£¬aÔÚλÖÃ1É ......
»ù±¾ÉÏÈ«²¿¼ÓÁË×¢ÊÍ,Ò»ÐÐÒ»×¢....ºÇºÇ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Êý×éÅÅÐò</title>
<mce:style type="text/css"&g ......
ʵÀý˵Ã÷»á¸üÇå³þЩ£¬¼ÙÉèÓÐÈçÏÂXMLÎļþ£º
¡¡File: message_hutaow.xml
<?xml version="1.0" encoding="UTF-8"?>
<hutaow:Message version="1.0" xmlns:hutaow="http://wangtao.cublog.cn">
<hutaow:Head>
<hutaow:Date>20080502</hutaow:Date>
<hutaow:Source>
......