Hi,
Iam having a problem in assigning a dynanic url to window.open function.
My page has the below:
Input textbox where user will enter the IP and a href link next to the textbox.
My code should do the following
Collect the IP address entered by user from the Input textbox and when the link is clicked open a new window with that IP as shown…. http://<ip>
In my HTML,
<input type=”text” name=”IP Address2″ size=”16″ class=control>
<A href=”javascript?penURL()” >
<font face=Arial size=2 color=”blue” >
<U><B>Open this Webpage</B></U>
</font>
</A>
In Javascript code,
function OpenURL()
{
var url=’
alert(url);
window.open(url,’open_window’,’location=yes,resizable=yes,dependent=yes,width=500,height=380,left=0,top=0′);
}
When the url is hardcodded as above, it works fine… but the below code does not
function OpenURL()
{
var ip = document.getElementById(‘IP Address2’).value;
alert(ip); // here the ip shows fine ex:192.168.5.66
var url=”http://”+ ip;
alert(url); // here url fine ex:[url]http://192.168.5.66
window.open(‘url’,’open_window’,’location=yes,resizable=yes,dependent=yes,width=500,height=380,left=0,top=0′);
}
but the popup window does not open to the correct url.
can anyone guide where i maybe going wrong?
Thanks in advance
Queenie