0
我试图让我的着陆页上显示的URL参数,但它不工作。getURLParameter登陆页面
<script>
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1] || ''
);
}
</script>
<br>
<h1><b>Your <script>document.write(getURLParameter("devicebrand") + (" ") + getURLParameter("devicemodel"))</script>might be infected with <span id="blink"> (6)</span>Viruses!</b></h1>
我得到的着陆页是:
你可能与病毒感染
当我强制值网址:
这是网址
www.domain.com/page.html?devicebrand=Apple&devicemodel=Iphone
什么也没有发生
任何帮助是极大的赞赏
感谢您的回答mplungjan,我绝对新手,我应该把我的文字“你可能与病毒感染”? –
该文本现在可以在任何地方。我的代码通常存储在脚本标记 – mplungjan
好吧,我明白!谢谢 我测试了我的android上的新链接现在它仍然说iphone虽然 var loc =“#devicebrand = iPhone&devicemodel = 6S”这是我用的,还是一个例子? –