Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
code as follows

Open



var myWindow;
function openWin() {
myWindow = window.open("", "myWindow", "width=200,height=100");
myWindow.document.write("

This is 'myWindow'

");
}


i have one button callled open

when i click that i have to open a new window

for that i written a above code.

when i run the code shows error as follows

Uncaught ReferenceError: openWin is not defined at HTMLButtonElement.onclick

please help me what is the mistake in my above code

What I have tried:

code as follows

Open


var myWindow;
function openWin() {
myWindow = window.open("", "myWindow", "width=200,height=100");
myWindow.document.write("

This is 'myWindow'

");
}


i have one button callled open

when i click that i have to open a new window

for that i written a above code.

when i run the code shows error as follows

Uncaught ReferenceError: openWin is not defined at HTMLButtonElement.onclick

please help me what is the mistake in my above code
Posted
Updated 25-Dec-17 20:02pm

sir try the bellow code may help you

window.open(skey, "_blank", "toolbar=1, scrollbars=1, resizable=1, width=" + 1015 + ", height=" + 800);
 
Share this answer
 
It is telling you that it couldn't locate the
openWin()
function. Considering:
1. JS is case sensitive, e.g. openWin() is not the same as openwin().
2. If that function is in an external file, have you imported it properly. HTML script src Attribute[^]
Check out the working example at Open New Window with JS[^]
 
Share this answer
 
v2
Comments
Patrice T 26-Dec-17 3:10am    
Typos? 'is same' or 'is not same' ?
Peter Leow 26-Dec-17 3:15am    
Yes, it's typo. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900