简体   繁体   English

我想在每次点击事件中打开新窗口的浏览器……在jsp中

[英]i want to open new window browser at every click event… in jsp

I am just facing the issue at open new browser at "each click event previous opened stay that" . 我只是在打开新的浏览器时遇到问题,该问题位于“每次单击事件之前打开的保持该位置” i want that. 我要那个。

Look i want to open window browser at click event... it opens fine. 看我想在单击事件时打开窗口浏览器...它可以很好地打开。

But i want at each click it opens new browser. 但是我想每次点击都会打开新的浏览器。 how can i do that? 我怎样才能做到这一点?

it always override that new window. 它始终会覆盖该新窗口。 i want always open a new window. 我想总是打开一个新窗口。

i used: 我用了:

function Validation(){
    var i=0;    
    if(document.netsim.emulatorNo.value=="")
    {
        alert ( "Please Fiil Emulator Number" );    
        netsim.emulatorNo.focus();      
        i=1;
    }else {
        var emu =  document.netsim.emulatorNo.value;
        var serverUrl = document.netsim.Apply.value;
        window.open('http://localhost:8080/SMSSimulator/NewEmulator.jsp?emulator='+emu+'&ServerUrl='+serverUrl,'mywindow','width=400,height=350');
    }
    if(i==1)
        return false;   
}

suggest me to find out my answer. 建议我找出答案。

Thanks in advance. 提前致谢。

you need to give different window names to each window. 您需要为每个窗口指定不同的窗口名称。 so, 'mywindow' needs to be changed. 因此,“ mywindow”需要更改。 try something like; 尝试类似的东西;

var counter = 0;

function Validation(){ 
    var i=0;     
    if(document.netsim.emulatorNo.value=="") 
    { 
        alert ( "Please Fiil Emulator Number" );     
        netsim.emulatorNo.focus();       
        i=1; 
    }else { 
        var emu =  document.netsim.emulatorNo.value; 
        var serverUrl = document.netsim.Apply.value; 
        window.open('http://localhost:8080/SMSSimulator/NewEmulator.jsp?emulator='+emu+'&ServerUrl='+serverUrl,'mywindow'+counter,'width=400,height=350'); 
        counter++;
    } 
    if(i==1) 
        return false;    
} 

Here you open the new window in a specific place called 'mywindow' 在这里,您可以在名为“ mywindow”的特定位置打开新窗口

window.open('http://localhost:8080/SMSSimulator/NewEmulator.jsp?emulator='+emu+'&ServerUrl='+serverUrl,'mywindow','width=400,height=350');

you can change it to blank or "_blank" and it will open it in a new window: 您可以将其更改为空白或“ _blank”,它将在新窗口中将其打开:

window.open('http://localhost:8080/SMSSimulator/NewEmulator.jsp?emulator='+emu+'&ServerUrl='+serverUrl,'','width=400,height=350');

there is no need to naming it unless you have a javascript that reference the window 除非您有引用窗口的JavaScript,否则无需命名它

window.open(url, unique_title, features) 

If you want to open it always on the new window use a unique window title everytime, else it will keep on opening on the same window. 如果要始终在新窗口中打开它,请每次使用唯一的窗口标题,否则它将继续在同一窗口上打开。

Example sample html and popup opens fine in new window always - 示例示例html和弹出窗口始终会在新窗口中正常打开-

<html>
<script>
    var counter = 0;
    function openWindow(){
        window.open('http://www.google.com','mywindow'+counter,'width=400,height=350');
        counter++;
    }
</script>
<body>
    <input type="button" value="button" id="button" onclick="openWindow()" />
</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM