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>

Link to comment
Share on other sites

 

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>

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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 ^

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.