日期:2014-05-16  浏览次数:20439 次

js得到url地址里面的参数
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Raker</title>
<style type="text/css">
<!--
.STYLE1 { color: #009999 }
body { background:#000; color:#fff; font-size:2em }
dl dt { width:480px; text-align:center; padding-top:150px }
dl dd { width:480px; text-align:center; margin:0; padding-top:40px }
img { border:0 }
-->
</style>
<script type="text/javascript">
function request(paras) //用来得到url地址里面的参数
{
var url = location.href;
var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
var paraObj = {}
for (i=0; j=paraString; i++){
paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);
}
var returnValue = paraObj[paras.toLowerCase()];
if(typeof(returnValue)=="undefined"){
return "";
}else{
return returnValue;
}
}

//alert(request('view'));
</script>
</head>
<body>
<dl>
  <dt>Connection exception</dt>
  <dd><img src="img/01.png" /></dd>
  <dd><a href="#"><img id="clewImg" src="img/but_01.png" /></a>
  <script type="text/javascript">
   document.getElementById('clewImg').src = "img/but_0"+request('view')+".png";
  </script>
    <!--<a href="#"><img src="img/but_02.png" /></a>-->
  </dd>
</dl>
</body>
</html>