我这需要newPage不等于空,要怎么改啊,大神们Uncaught SyntaxError: Unexpected token !报这个错误window.onload = initForm;window.onunload = function(){};function initForm(){ document.getElementById("newLocation").selectedIndex = 0; document.getElementById("newLocation").onchange = jumppage;}function jumppage(){ var newLoc = document.getElementById("newLocation"); var newPage = newLoc.option[newLoc.selectedIndex].value; if(newPage ! = ''){ window.location = newPage; }}
3 回答
已采纳
慕运维7130634
TA贡献41条经验 获得超18个赞
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
var newPage;
if(newPage!=""){
alert(1)//不报错
}
</script>
</body>
</html>
添加回答
举报
0/150
提交
取消