JavaScriptµÄwithÓï¾ä
withÓï¾ä
ÓÃÓÚÉèÖôúÂëÌØ¶¨¶ÔÏóµÄ×÷ÓÃÓò¡£
Àý£º
var sMessage = "hello world";
with(sMessage)
{
alert(toUpperCase()); //Êä³ö "HELLO WORLD"
}
withÓï¾äÊÇÔËÐлºÂýµÄ´úÂë¶Î£¬ÓÈÆäÊÇÔÚÒÑÉèÖÃÁËÊôÐÔֵʱ¡£´ó¶àÊýÇé¿öÏ£¬¾¡Á¿±ÜÃâʹÓÃËü¡£
Ïà¹ØÎĵµ£º
JavaScriptÖÐûÓÐTrimº¯Êý£¬VBScriptÓïÑÔÖвÅÓÐÕâ¸öº¯Êý£¬¾ÍÊÇÈ¥µô×Ö·û´®Í·ºÍβµÄ¿Õ¸ñ¡£¿ÉÒÔÔÚJavaScriptÖÐÕâôдһ¸ö£º
<script language="JavaScript">
//´Ë´¦ÎªstringÀàÌí¼ÓÈý¸ö³ÉÔ±
String.prototype.Trim = function(){ return Trim(this);}
String.prototype.LTrim = function(){return LTrim( ......
Ã²ËÆCSDNÀïµÄ¶¼ÊÇרҵÈËÊ¿£¬¸ßÊÖ¿ÉÒÔÂÓ¹ýÁË£¬ºÇºÇ¡£
Ò»ÏÂÊÇÔ´Â룺
<!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>
<meta http-equiv="Content-Type" content ......
1.asp.netºô½Ðjs
view
plain
copy
to clipboard
print
?
Response.Write("<mce:script language=javascript><!--
");
Response.Write("alert('»¶ÓÄú ');"
);
Response.Write("location.href='login.aspx';"
)& ......
1.Dean Edwards±àдµÄPacker£¨http://dean.edwards.name/packer/£©£¬ÓÃÓÚѹËõJavaScript
2.»ñÈ¡JQuery£ºhttp:/jquery.com
http://docs.jquery.com/Downloading_jQuery ÏÂÔØ¸÷¸ö°æ±¾¼°ÏàÓ¦°ïÖúÎ ......
ÓÃÓÚö¾Ù¶ÔÏóµÄÊôÐÔ
Àý£º
for(sProp in window)
{
alert(sProp); //ÏÔʾBOM window¶ÔÏóµÄËùÓÐÊôÐÔ¡£
}& ......