JavaScriptÅжÏä¯ÀÀÆ÷ÀàÐͼ°°æ±¾
ÄãÖªµÀÊÀ½çÉÏÓжàÉÙÖÖä¯ÀÀÆ÷Â𣿳ýÁËÎÒÃÇÊìÖªµÄIE, Firefox, Opera, SafariËÄ´óä¯ÀÀÆ÷Ö®Í⣬ÊÀ½çÉÏ»¹Óнü°ÙÖÖä¯ÀÀÆ÷¡£
¼¸ÌìÇ°£¬ä¯ÀÀÆ÷¼Ò×åÓиյ®ÉúÁËһλСÍõ×Ó£¬¾ÍÊÇGoogleÍƳöµÄChromeä¯ÀÀÆ÷¡£ÓÉÓÚChrome³öÉúÃûÃÅ£¬¾¡¹ÜËû»¹ÊǸöС¼Ò»ï£¬Ã»ÓÐÈ˸ÒС¿´Ëû¡£ÒÔºó£¬ÔÛÃdz£Ëµä¯ÀÀÆ÷µÄ“ËÄ´ó²Å×Ó”¾ÍµÃ¸Ä³ÆΪ“Îå¶ä½ð»¨”ÁË¡£
ÔÚÍøվǰ¶Ë¿ª·¢ÖУ¬ä¯ÀÀÆ÷¼æÈÝÐÔÎÊÌâ±¾ÒÑÈÃÎÒÃÇÊÖæ½ÅÂÒ£¬ChromeµÄ³öÊÀ²»ÖªµÀÓÖÒª¸øÎÒÃÇÌí¶àÉÙÂÒ×Ó¡£ä¯ÀÀÆ÷¼æÈÝÐÔÊÇÇ°¶Ë¿ª·¢¿ò¼ÜÒª½â¾öµÄµÚÒ»¸öÎÊÌ⣬Ҫ½â¾ö¼æÈÝÐÔÎÊÌâ¾ÍµÃÊ×ÏÈ׼ȷÅжϳöä¯ÀÀÆ÷µÄÀàÐͼ°Æä°æ±¾¡£
JavaScriptÊÇÇ°¶Ë¿ª·¢µÄÖ÷ÒªÓïÑÔ£¬ÎÒÃÇ¿ÉÒÔͨ¹ý±àдJavaScript³ÌÐòÀ´ÅжÏä¯ÀÀÆ÷µÄÀàÐͼ°°æ±¾¡£JavaScriptÅжÏä¯ÀÀÆ÷ÀàÐÍÒ»°ãÓÐÁ½ÖÖ°ì·¨£¬Ò»ÖÖÊǸù¾Ý¸÷ÖÖä¯ÀÀÆ÷¶ÀÓеÄÊôÐÔÀ´·Ö±æ£¬ÁíÒ»ÖÖÊÇͨ¹ý·ÖÎöä¯ÀÀÆ÷µÄuserAgentÊôÐÔÀ´Åжϵġ£ÔÚÐí¶àÇé¿öÏ£¬ÖµÅжϳöä¯ÀÀÆ÷ÀàÐÍÖ®ºó£¬»¹ÐèÅжÏä¯ÀÀÆ÷°æ±¾²ÅÄÜ´¦Àí¼æÈÝÐÔÎÊÌ⣬¶øÅжÏä¯ÀÀÆ÷µÄ°æ±¾Ò»°ãÖ»ÄÜͨ¹ý·ÖÎöä¯ÀÀÆ÷µÄuserAgent²ÅÄÜÖªµÀ¡£
ÎÒÃÇÏÈÀ´·ÖÎöһϸ÷ÖÖä¯ÀÀÆ÷µÄÌØÕ÷¼°ÆäuserAgent¡£
IE
Ö»ÓÐIEÖ§³Ö´´½¨ActiveX¿Ø¼þ£¬Òò´ËËýÓÐÒ»¸öÆäËûä¯ÀÀÆ÷ûÓеĶ«Î÷£¬¾ÍÊÇActiveXObjectº¯Êý¡£Ö»ÒªÅжÏwindow¶ÔÏó´æÔÚActiveXObjectº¯Êý£¬¾Í¿ÉÒÔÃ÷È·Åжϳöµ±Ç°ä¯ÀÀÆ÷ÊÇIE¡£¶øIE¸÷¸ö°æ±¾µäÐ͵ÄuserAgentÈçÏ£º
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)
ÆäÖУ¬°æ±¾ºÅÊÇMSIEÖ®ºóµÄÊý×Ö¡£
Firefox
FirefoxÖеÄDOMÔªËض¼ÓÐÒ»¸ögetBoxObjectForº¯Êý£¬ÓÃÀ´»ñÈ¡¸ÃDOMÔªËصÄλÖúʹóС£¨IE¶ÔÓ¦µÄÖÐÊÇgetBoundingClientRectº¯Êý£©¡£ÕâÊÇFirefox¶ÀÓеģ¬ÅжÏËü¼´¿ÉÖªµÀÊǵ±Ç
Ïà¹ØÎĵµ£º
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= ......
½øÈëеÄÏîÄ¿×éºó£¬·¢ÏÖ×Ô¼ºµÄ¹¦Á¦²îÔ¶ÁË£¬ËûÃÇдµÄjavaScript´úÂëÎҺܶ඼¿´²»¶®£¬ÏÖÔÚÎÒ×öjavaÇ°¶Ë¿ª·¢£¬javaScriptÊǷdz£ÖØÒªµÄ£¬ÏÖÔÚÎÒ¾ö¶¨ÖØÐÂÊ°Æð¡¶JavaScript¸ß¼¶³ÌÐòÉè¼Æ¡·Ñ§Ï°£¬³ÉΪһ¸öjavaScriptÄÜÊÖ¡£
¿´ÍêµÚÒ»ÕÂÎÒµ½»¹ÊǸ㲻Ã÷°×DOMµÄÒâ˼¡£
......
ÎÊ:
Hi,
I have this C#/ASP.NET/.aspx page with a string variable named myString with the value "Mario Gamito".
How can I access "Mario Gamito" from within a JavaScript function, i. e., the variable's value ?
Already tried '" + mystring + "' but it doesn't works.
Any help would be appreciated.
......
1.HTMLÎĵµÊ÷Ðαíʾ
2.Node[] Node.childNodes
//·µ»ØNode¶ÔÏóµÄËùÓÐ×Ö½Úµã
3.Node.firstChild / lastChild /nextSibling(ÏÂÒ»¸öÐֵܽڵã) / previousSibling (ÉÏÒ»¸öÐֵܽڵã) / parentNode
ÊôÐÔ
4.Node.appendChild() / removeChild() / replaceChil ......
<mce:script language="javascript" ><!--
function person(name,age)
{
this.name=name;
this.age=age;
}
function man(name,age)
{
this.sex="ÄÐ";
this.base=person;
this.base(name,age);
}
function woman(name,age)
{
this.sex="Å®";
this.base=person;
this.base(name,age)
}
......