A2xA Posted February 1, 2008 Share Posted February 1, 2008 Why dosen't my window pop up with my custom dimensions? This is a javascript that makes what the user types in fills in a variable and pops up with their page. <html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- Idea by: Nic Wolfe --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=275,height=300');"); } // End --> </script> </head> <body> <div style="text-align: left;"><a href="http://wiicharged.com/index.php?action=hubs"><img style="border: 0px solid ; width: 656px; height: 125px;" alt="Wii forum friend codes" src="http://i27.tinypic.com/2n24pag.png"></a><br> </body> <form> <input type=button value="Join the hub" onClick="javascript:popUp('http://wiicharged.com/index.php?action=hubs')"> </form> </html> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 1, 2008 Share Posted February 1, 2008 Your code only opens a predefined url in your pop-up. If you want the individual end user to be able too open up a url of their choice in your pop-up; then you need to do it like this. <html> <head> <script language="javascript"> function popUp() { day = new Date(); id = day.getTime(); var URL = document.getElementById('urlselection').value; window.open(URL,'' + id + '','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=275,height=300') } </script> </head> <body> <div style="text-align: left;"><a href="http://wiicharged.com/index.php?action=hubs"><img style="border: 0px solid ; width: 656px; height: 125px;" alt="Wii forum friend codes" src="http://i27.tinypic.com/2n24pag.png"></a><br> <br><br> <form onsubmit="popUp(); return false"> <input type="text" id="urlselection"> <input type=button value="Join the hub" onClick="popUp()"> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
GameYin Posted February 1, 2008 Share Posted February 1, 2008 var URL = document.getElementById('urlselection').value; window.open(URL,'' + id + '','toolbar=0,scrollbars="0",location="0",statusbar="0",menubar="0",resizable="0",width="275",height="300"') } Quote Link to comment Share on other sites More sharing options...
A2xA Posted February 1, 2008 Author Share Posted February 1, 2008 is there anyway to do it like this? with a custom url plus the users "ID" . Sort of like a variable? I tried this and it didn't work. The form wouldn't submit var URL = document.getElementById('http://wiicharged.com/hubchat/''urlselection''/shout.swf').value; Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 1, 2008 Share Posted February 1, 2008 don't actually know what your trying to do, but here you go: var URL = document.getElementById('http://wiicharged.com/hubchat/'+urlselection+'/shout.swf').value; Quote Link to comment Share on other sites More sharing options...
A2xA Posted February 2, 2008 Author Share Posted February 2, 2008 now it won't submit :-\ <html> <head> <script language="javascript"> function popUp() { day = new Date(); id = day.getTime(); var URL = document.getElementById('http://wiicharged.com/hubchat/'+urlselection+'/shout.swf').value; window.open(URL,'' + id + '','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=375,height=400') } </script> </head> <body> <div style="text-align: left;"><a href="http://wiicharged.com/index.php?action=hubs"><img style="border: 0px solid ; width: 656px; height: 125px;" alt="Wii forum friend codes" src="http://i27.tinypic.com/2n24pag.png"></a><br> <br><br> <form onsubmit="popUp(); return false"> <input type="text" id="urlselection"> <input type=button value="Join the hub" onClick="popUp()"> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 2, 2008 Share Posted February 2, 2008 You cannot put a url in document.getElementById; that is not the way it works. I missed that before; sorry about that. Use the original code I provided you; before you changed it. Quote Link to comment Share on other sites More sharing options...
A2xA Posted February 2, 2008 Author Share Posted February 2, 2008 Well, what I'm trying to do is fill in that variable. Basically the user has made a hub "ID" and when they type that it it pops up their hub which is a chat window. I don't want them to type in /hubchat/etc... so is there any other way to make that automatically be filled in? Maybe in the form itself? Quote Link to comment Share on other sites More sharing options...
A2xA Posted February 2, 2008 Author Share Posted February 2, 2008 something like this? <SCRIPT LANGUAGE="JavaScript"><!-- function copydata() { document.formthree.mytextone.value = document.formone.mytextone.value; document.formthree.mytexttwo.value = document.formtwo.mytexttwo.value; document.formthree.submit(); return false; } //--></SCRIPT> <FORM NAME="formone" onSubmit="return copydata()"> Enter some text: <INPUT TYPE="text" NAME="mytextone"> <P><INPUT TYPE="BUTTON" VALUE="Submit" onClick="copydata()"> </FORM> <FORM NAME="formtwo" onSubmit="return copydata()"> Enter some text: <INPUT TYPE="text" NAME="mytexttwo"> <P><INPUT TYPE="BUTTON" VALUE="Submit" onClick="copydata()"> </FORM> <FORM NAME="formthree"> <INPUT TYPE="HIDDEN" NAME="mytextone"> <INPUT TYPE="HIDDEN" NAME="mytexttwo"> </FORM> Quote Link to comment Share on other sites More sharing options...
A2xA Posted February 2, 2008 Author Share Posted February 2, 2008 or something with the forms like this? <form onsubmit="popUp(); return false"> <input type="hidden" id="urlselection" value="/hubchats/"> <input type="text" id="urlselection"> <input type="hidden" id="urlselection" value="shout.swf"> <input type=button value="Join the hub" onClick="popUp()"> </form> ^ that didn't work ^ Quote Link to comment Share on other sites More sharing options...
GameYin Posted February 2, 2008 Share Posted February 2, 2008 <form onsubmit="popUp(); return false"> <input type="hidden" id="urlselection" value="/hubchats/"> <input type="text" id="urlselection"> <input type="hidden" id="urlselection" value="shout.swf"> [b]<input type=button value="Join the hub" onClick="popUp()">[/b] </form> Wrong. It won't submit since you did it wrong <form onsubmit="popUp(); return false"> <input type="hidden" id="urlselection" value="/hubchats/"> <input type="text" id="urlselection"> <input type="hidden" id="urlselection" value="shout.swf"> [b]<input type="submit" value="Join the hub" onClick="popUp()">[/b] </form> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 2, 2008 Share Posted February 2, 2008 Is this what your wanting? The script is now set-up for your users/members to type just their id number in and the pop-up window will open up to that page, with their id number sent in a query string, to that page. <script language="javascript"> function popUp() { var id = document.getElementById('urlselection').value; window.open('http://wiicharged.com/index.php?action=hubs&id='+id+'','' + id + '','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=275,height=300'); } </script> <form onsubmit="popUp(); return false"> <input type="text" id="urlselection"> <input type="button" value="Join the hub" onClick="popUp()"> </form> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.