Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#ºǫ́µ÷ÓÃǰ̨javascriptµÄÎåÖÖ·½·¨


ÓÉÓÚÏîÄ¿ÐèÒª£¬Óõ½ÆäËûÏîÄ¿×éÓÃVC¿ª·¢µÄ×é¼þ£¬ÔÚwebºǫ́´úÂëÎÞ·¨·ÃÎÊÕâ¸ö×é¼þ£¬ËùÒÔÖ»ºÃͨ¹ýºǫ́µ÷ÓÃǰ̨µÄjavascript£¬´Ó¶ø²Ù×÷Õâ¸ö×é¼þ¡£ÔÚÍøÉÏÕÒÁËÕÒ£¬·¢ÏÖÓÐÈýÖÖ·½·¨¿ÉÒÔ·ÃÎʵ½Ç°Ì¨´úÂ룺
µÚÒ»ÖÖ£¬OnClientClick    (vs2003²»Ö§³ÖÕâ¸ö·½·¨)
<asp:Button ID="Button1" runat="server" Text="Button"  OnClientClick="client_click()" OnClick="Button1_Click"  />
client_click() ¾ÍÊÇjavascriptµÄÒ»¸ö·½·¨¡£
µÚ¶þÖÖ£¬Button1.Attributes.Add("onclick", "return Client_Click()"); 
“Client_Click() “ÊÇÒ»¸öǰ̨·½·¨£¬¿ÉÒÔÌæ»»³ÉÒ»°ãµÄ½Å±¾È磺retrun confirm('È·¶¨É¾³ýÂð£¿')
µÚÈýÖÖ£¬ÊÇÎÒ×ÔÈÏΪ×îÁé
»îµÄÒ»ÖÖ£¬ClientScript.RegisterStartupScript
Àý×Ó£ºStringBuilder sb = new StringBuilder();
        sb.Append("<script language='javascript'>");
        sb.Append("Button2_onclick('" + serverPath + "')");
        sb.Append("</script>");
        ClientScript.RegisterStartupScript(this.GetType(), "LoadPicScript", sb.ToString());
µÚËÄÖÖ
.

ÓÃResponse.Write·½·¨Ð´Èë½Å±¾
±ÈÈçÔÚÄãµ¥»÷°´Å¥ºó£¬ÏȲÙ×÷Êý¾Ý¿â£¬ÍêÁ˺óÏÔʾÒѾ­Íê³É£¬¿ÉÒÔÔÚ×îºóÏëµ÷Óõĵط½Ð´ÉÏ
Response.Write("<script type='text/javascript'>alert();</script>");
Õâ
¸ö·½·¨ÓиöȱÏݾÍÊDz»Äܵ÷Óýű¾ÎļþÖеÄ×Ô¶¨ÒåµÄº¯Êý£¬Ö»Äܵ÷ÓÃÄÚ²¿º¯Êý£¬¾ßÌåµ÷ÓÃ×Ô¶¨ÒåµÄº¯ÊýÖ»ÄÜÔÚResponse.WriteдÉϺ¯Êý¶¨Ò壬±ÈÈç
Response.Write("<script type='text/javascript'>function
myfun(){...}</script>");
µÚÎåÖÖ

ÓÃClientScriptÀද̬Ìí¼Ó½Å±¾
    Ó÷¨ÈçÏ£ºÔÚÏëµ÷ÓÃij¸öjavascript½Å±¾º¯ÊýµÄµØ·½Ìí¼Ó´úÂ룬עÒâÒª±£Ö¤MyFunÒѾ­Ôڽű¾ÎļþÖж¨Òå¹ýÁË¡£
    ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>MyFun();</script>");
Õ


Ïà¹ØÎĵµ£º

javascript ³£ÓõÄ55¸ö¼¼ÇÉ

1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="return f ......

JavaScriptÈ¡µÃselect option value

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<mce:style type="text/css"><!--

div#show { float: right; color: blue; }

--></mce:style><style type="text/css" mce_bogus=" ......

javascript²Ù×÷DOM

1.´´½¨½Úµã²¢Ìí¼ÓÄÚÈÝ:ʹÓõķ½·¨:createElementºÍcreateTextNode
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>HTML DOM</title>
&nbs ......

ÔÚC#.netÖÐÈçºÎ²Ù×÷XML


ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâƪÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆһϴúÂëÊÔÒ»ÏÂ.ÕâƪÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlele ......

JavaScriptÖеĿÕÀàÐÍ

תÔØÀíÓÉ£º¶ÌС¾«º·¡£
À´Ô´£º»¥ÁªÍø
Ò» Undefined ÀàÐÍ
Ö»ÓÐÒ»ÖÖÖµ undefined
ÒÔÏÂÈýÖÖÇé¿ötypeof ·µ»ØÀàÐÍΪundefined
1. µ±±äÁ¿Î´³õʼ»¯Ê±
2. ±äÁ¿Î´¶¨Òåʱ
3. º¯ÊýÎÞÃ÷È··µ»Øֵʱ£¨º¯ÊýûÓзµ»Øֵʱ·µ»ØµÄ¶¼ÊÇundefined£©
undefined ²¢²»µÈͬÓÚ䶨ÒåµÄÖµ
typeof ²¢²»ÕæÕýÇø·ÖÊÇ·ñÊÇ䶨Òå
¿´ÒÔÏÂʾÀý ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ