ͨ¹ýjavascript»ñµÃurl²ÎÊý
Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs»ñÈ¡url²ÎÊýÄØ£¿
ÔĶÁ ±à¼ ÔËÐÐ ¸´ÖÆ ±£´æ
<!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> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript">
function GetUrlParms()
{
var args=new Object();
var query=location.search.substring(1);//»ñÈ¡²éѯ´®
var pairs=query.split("&");//ÔÚ¶ººÅ´¦¶Ï¿ª
for(var i=0;i<pairs.length;i++)
{
var pos=pairs[i].indexOf('=');//²éÕÒname=value
if(pos==-1) continue;//Èç¹ûûÓÐÕÒµ½¾ÍÌø¹ý
var argname=pairs[i].substring(0,pos);//ÌáÈ¡name
var value=pairs[i].substring(pos+1);//ÌáÈ¡value
args[argname]=unescape(value);//´æΪÊôÐÔ
}
return args;
}
//ʹÓ÷½·¨£º
var args = new Object();
args = GetUrlParms();
//Èç¹ûÒª²éÕÒ²ÎÊýArticleID:
var articleID = args["ArticleID"];
alert(articleID);
//Èç¹ûÒª²éÕÒ²ÎÊýTypeID
var typeID = args["TypeID"];
alert(typeID);
</script>
</head>
<body>
</body>
</html>
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
Dynamic Script Elements ¶¯Ì¬½Å±¾ÔªËØ
The Document Object Model (DOM) allows you to dynamically create almost any part of an HTML document using JavaScript. At its root, the <script> element isn't any different than any other element on a page: references can be retrie ......
XMLHttpRequest Script Injection XHR½Å±¾×¢Èë
Another approach to nonblocking scripts is to retrieve the JavaScript code using an XMLHttpRequest (XHR) object and then inject the script into the page. This technique involves creating an XHR object, downloading the JavaScript f ......
¾¼¸Ìì˼¿¼£¬Ïëµ½Ò»¸ö½Ð¡°ÎļþÓëÄ£¿é¡±µÄÎÊÌâ¡£ÎÒÃǵÄÄ£¿é¿Ï¶¨Ð´ÔÚÒ»¸öJSÎļþÖУ¬ÕâЩģ¿éÓÖ¿ÉÒÔ·ÖΪºËÐÄÄ£¿éÓëÍâΧģ¿é¡£ºËÐÄÄ£¿éµ±È»Ð´ÔÚÖ÷ÎļþÖУ¬ËüÓ¦¸Ã°üº¬×îÖØÒªµÄÂß¼£¬¼ÓÔØÆ÷£¬Áжӣ¬ÃüÃû¿Õ¼ä¹¹ÔìÆ÷µÈµÈ¡£µ«Èç¹ûÒ»¸öÎļþÖ»´æÔÚÒ»¸öÄ£¿éÕâҲ̫ÀË·ÑÁË£¬¶øÇһᵼÖÂÇëÇ󷨹ý¶à£¬Òò´Ë³öÏÖ¶à¸öÄ£¿é¡°¹²Éú¡±ÓÚÒ»¸öÎļþµÄÇé ......
<!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="text/html; charset=gb2312" />
&nb ......