当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript静态的url如何传递

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 javascript静态的url如何传递


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 59 ::
收藏到网摘: n/a

<!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>无标题 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>
处理页面:
复制代码 代码如下:

<Html>
<Head>
<Meta http-equiv="Content-Type"content="text/html; charset=gb2312">
<Title>示例</Title>
<script>
function QueryString()
{//构造参数对象并初始化
var name,value,i;
var str=location.href;//获得浏览器地址栏URL串
var num=str.indexOf("?")
str=str.substr(num+1);//截取“?”后面的参数串
var arrtmp=str.split("&");//将各参数分离形成参数数组
for(i=0;i < arrtmp.length;i++){
num=arrtmp[i].indexOf("=");
if(num>0){
name=arrtmp[i].substring(0,num);//取得参数名称
value=arrtmp[i].substr(num+1);//取得参数值
this[name]=value;//定义对象属性并初始化
}
}
}
var Request=new QueryString();//使用new运算符创建参数对象实例
</script>
</Head>
<Body>
<script>
var newElement=document.createElement("div");//创建div对象
var str="图片地址为:<u>"+Request["testImage"]+"</u>";//利用实例["字段名称"]获取参数内容
newElement.innerHTML=str;
document.body.appendChild(newElement);//向文档添加div对象
</script>
</Body>
</Html>