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. 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'
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:
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
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>
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.