欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript靜態(tài)的url如何傳遞

 更新時(shí)間:2007年05月03日 00:00:00   作者:  
<!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=utf-8" />
<title>無標(biāo)題 1</title>
</head>

<body>
<div id="testWrap">
<img src="http://bbs.blueidea.com/images/blue/logo.gif" alt="test image" name="testImage" id="testImage" />
</div>
<script>
function ImgClick(){
var hhj;
hhj=document.getElementById("testImage").getAttribute("src");
window.location="http://www.jsjdzx.com/bbs/images/upfile/200753182445.htm?testImage="+hhj;
}
</script>
<a href="javascript:ImgClick();" onclick="javascript:ImgClick();">傳圖片地址</a>
</body>

</html>
處理頁面:
復(fù)制代碼 代碼如下:

<Html>
<Head>
<Meta http-equiv="Content-Type"content="text/html; charset=gb2312">
<Title>示例</Title>
<script>
function QueryString()
{//構(gòu)造參數(shù)對(duì)象并初始化
var name,value,i;
var str=location.href;//獲得瀏覽器地址欄URL串
var num=str.indexOf("?")
str=str.substr(num+1);//截取“?”后面的參數(shù)串
var arrtmp=str.split("&");//將各參數(shù)分離形成參數(shù)數(shù)組
for(i=0;i < arrtmp.length;i++){
  num=arrtmp[i].indexOf("=");
  if(num>0){
   name=arrtmp[i].substring(0,num);//取得參數(shù)名稱
   value=arrtmp[i].substr(num+1);//取得參數(shù)值
   this[name]=value;//定義對(duì)象屬性并初始化
   }
}
}
var Request=new QueryString();//使用new運(yùn)算符創(chuàng)建參數(shù)對(duì)象實(shí)例
</script>
</Head>

<Body>
<script>
var newElement=document.createElement("div");//創(chuàng)建div對(duì)象
var str="圖片地址為:<u>"+Request["testImage"]+"</u>";//利用實(shí)例["字段名稱"]獲取參數(shù)內(nèi)容
newElement.innerHTML=str;
document.body.appendChild(newElement);//向文檔添加div對(duì)象
</script>

</Body>
</Html>

相關(guān)文章

最新評(píng)論