Jump to content

[SOLVED] why dosen't the window pop up with custom dimensions?


A2xA

Recommended Posts

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>

 

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>

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;

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>

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?

 

 

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>

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 ^

<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>

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>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.