嗨,我有一个页面,其中显示确认电子邮件后。我想在图片链接中显示该电子邮件。
为此,我使用了此代码,但我在这里得到了电子邮件变量 null。
<HTML>
<head>
<script type="text/javascript">
var formData = function() { var query_string = (location.search) ? ((location.search.indexOf('#') != -1) ? location.search.substring(1, location.search.indexOf('#')) : location.search.substring(1)) : '';
var elements = [];
if(query_string) {
var pairs = query_string.split("&");
for(i in pairs) {
if (typeof pairs[i] == 'string') {
var tmp = pairs[i].split("=");
var queryKey = unescape(tmp[0]);
queryKey = (queryKey.charAt(0) == 'c') ? queryKey.replace(/\s/g, "_") : queryKey;
elements[queryKey] = unescape(tmp[1]);
}
}
}
return {
display: function(key) {
if(elements[key]) {
document.write(elements[key]);
}
else {
document.write("<!--If desired, replace everything between these quotes with a default in case there is no data in the query string.-->");
}
}
}
}
(); </script>
</head>
<body>
<!-- Offer Conversion: Safe Binary Trades -->
<script type="text/javascript">formData.display("email")</script>
<img src="http://mountainfallsmedia.go2cloud.org/SL22?adv_sub="email" width="1" height="1" />
<!-- // End Offer Conversion -->
</body></HTML>
如果您查看您可以看到的最后几行代码formData.display("email")
,它用于显示电子邮件,它工作正常,但它不工作的情况下
<img src="http://mountainfallsmedia.go2cloud.org/SL22?adv_sub="email" width="1" height="1" />
我尝试通过传递formData.display("email")
而不是email
,但它仍然返回空白。