js获取html携带的url参数,并动态赋值给iframe的src,废话少说,直接上代码
<html>
<head>
<title>全屏玩游戏</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<script>
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split(“&”);
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split(“=”);
if(pair[0] == variable){return pair[1];}
}
return(false);
}function changeGameUrl(){
var url= getQueryVariable(‘url’);
document.getElementById(“gameUrl”).src = url;}
</script>
</head>
<body onload=”changeGameUrl();”>
<iframe id=”gameUrl” width=”100%” height=”100%” src=””></iframe>
</body>
</html>
ft348s
974ugm
xbkx4c