我是javascript的新手,所以理解这对大多数人来说很简单,但是如何获取已在javascript数组中设置的类项的值。
我需要检查“page”的值,if = value做某事,输出呈现的html代码
<script>
function subst() {
var vars={};
var x=document.location.search.substring(1).split('&');
for (var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
for (var i in x) {
var y = document.getElementsByClassName(x[i]);
for (var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
}
}
</script>