当我打开此页面时,没有任何反应。那么这段代码有什么错误呢?
这是代码:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function code(){
var filename = loc.pathname.split("/");
filename = filename[pathname.length-1];
alert(filename);
<iframe src="http://url/" +currentPageUrl scrolling="yes" style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
Your browser doesn't support IFrames
</iframe>`
}
</script>
<title>Index</title>
</head>
<body onload="code();">
</body>
</html>
我不确定您要做什么,但是您的代码中有很多错误。
loc
应该是位置
只是猜测您正在尝试类似的操作。
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function code() {
var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
document.body.innerHTML = "<iframe src=" + filename + " scrolling='yes' style='position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;'>your browser doesn't support iframe<iframe>";
}
</script>
<title>Index</title>
</head>
<body onload="code();">
</body>
</html>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句