用JavaScript接收html文件的参数
时间:[2006-12-25 14:09:01] 作者:作者不详
这个灵感是来于微软的FRAME指向的:
大家可以到
http://disapart.oso.com.cn/temp/urlinfo.html
做测试
////////////////例子:
<html><script>
var i=0;
function ol()
{
i=location.href.indexOf("?");
if(i!=-1)
{
str=location.href.substr(i+1,location.href.length-i-1);
alert(str);
document.open(true);
document.write(unescape(str));
document.close();
}
else
{
i=location.href.length;
}
}
function os()
{
str=location.href.substr(0,i)+"?"+document.all.tags("textarea").item(0).value;
location.href=str;
}
</script><body onload="ol()">
试试在下面输入HTML代码:<br>请注意:因为字符串没有编码,,所以加入的Script可能会有错误
<br><textarea cols=100 rows=20>
</textarea><br>
<button onclick="os()">看看结果</button>
</body></html>
【声明】本站刊载的《用JavaScript接收html文件的参数》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios