Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在window.load函数事件中使用window.open_Javascript_Javascript Events_Jakarta Ee - Fatal编程技术网

Javascript 如何在window.load函数事件中使用window.open

Javascript 如何在window.load函数事件中使用window.open,javascript,javascript-events,jakarta-ee,Javascript,Javascript Events,Jakarta Ee,我应该在javascript中的window.onload函数中使用window.open()。如果不知道如何使用该窗口。onload=“url”。请告诉我一些例子;氧化作用很好。一旦我输入run字符串,它就不会打开evovle.jsp(关注url) 例如: 函数validatetxtbox() {var txtfield; txtfield=document.getElementById('txtbox').value; 如果(txtfield==“运行”) {alert(“您输入的字符串正

我应该在javascript中的window.onload函数中使用window.open()。如果不知道如何使用该窗口。onload=“url”。请告诉我一些例子;氧化作用很好。一旦我输入run字符串,它就不会打开evovle.jsp(关注url)

例如:


函数validatetxtbox()
{var txtfield;
txtfield=document.getElementById('txtbox').value;
如果(txtfield==“运行”)
{alert(“您输入的字符串正确”);
window.onload=function(){window.open('evolve.jsp“欢迎”宽度=500,高度=500,菜单栏=yes,状态=yes,位置=yes,工具栏=yes,滚动条=yes');}
} 
else{alert(“重试”);}
}      

函数检查(){
var txtfield;txtfield=document.getElementById('txtbox').value;
如果(txtfield==“运行”)
{alert(“您输入的字符串正确”);
var newwin=window.open('evolve.jsp','welcome','width=500,height=500,menubar=yes,status=yes,location=yes,toolbar=yes');
newwin.focus();
} 
else{alert(“重试”);}
}
输入一个单词

使用querystring并签入evolve.jsp

Exevolve.jsp#alertme

非常感谢您的及时回复…madhav!!我不能用onblur代替onclick…。@hari如果你有一个按钮,你可以用onclick事件调用相同的方法,它同样有意义
<html>

<head>
<script type="text/javascript"> 
 function validatetxtbox() 
{      var txtfield;    
     txtfield =document.getElementById('txtbox').value; 
       if(txtfield == "run") 
     {  alert("you entered string right"); 

 window.onload=function(){window.open('evolve.jsp''welcome' 'width=500,height=500,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes');}           
 } 
else  {  alert("Try again");  }  
}      
</script>
 </head>

<body> 
<input type="text" id="txtbox" maxlength="3">
<input type="button" id="btn" value="Send" onclick="validatetxtbox()"> 

</body>
</html>  
<html>
<head>
<script ="text/javascript">
  function check() {
 var txtfield; txtfield =document.getElementById('txtbox').value; 
 if(txtfield == "run")
 { alert("you entered string right");
 var newwin=window.open('evolve.jsp','welcome','width=500,height=500,menubar=yes,status=yes,location=yes,toolbar=yes');
 newwin.focus();
 } 
 else { alert("Try again"); } 
  }
 </script>
  </head>
  <body>
  Enter a Keayword
  <input type="text" id="txtbox" onblur="check()" />
  </body>
</html>