• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

window.open (javascript)

jyrixx

Senior member
ok... i'm looking for any javascript guru out there... here is the problem, someone please help me. 😕 i'm trying to use one function to open up windows... we'll call it winOpen() ok... using this, is there a way to open other windows with different sizes and settings?? lets say using winOpen(new1) if so, please let me know how to do it.. i've been trying to get this to work for almost 2 hours... any help would be appreciated, and certainly if you need more info, i can supply it.. thanks in advance 🙂
 
yeah I have done that before, or at least I think I know what you want. hold on I'll go find it in my archives.
 
ok heres what you do:

create a function say winOpen(); the all you have to do is somewhere above where you declare the winOpen() function you just create a set of string variables with the proporties that change and create an array or list of these different properties and the function would go something like this:


<script language=&quot;Javascript&quot;>

//list your different windows here, one URL and one name for each,
var windowOneURL = &quot;http://www.anandtech.com&quot;;
var windowOnename = &quot;windowOne&quot;;
var windowOneSize = '&quot;width=500&quot;,&quot;height=400&quot;';

//heres the function
function winOpen(URL,name,size) {

//proporties that don't change between windows - what ever you need here
var staticOptions = '&quot;scrollbars=no&quot;,&quot;resizeable=no&quot;';

var finalOptions = staticOptions + ',' + size;

//open up the window with all of its proporties
var newWin = open(URL,name,finalOptions);
}
</script>

and all you have to do is just call it like this winOpen(windowOneURL,windowOnename,windowOneSize)



hope this helps you, I tried it out and I got it to work, if you have anyquestions feel free to ICQ me, and I will also check back here.
 
<SCRIPT LANGUAGE=&quot;JAVASCRIPT&quot;>
<!--Hide from old browsers

function openname(){
open(&quot;pagename.html&quot;,&quot;Windowname&quot;,&quot;WIDTH=700,HEIGHT=340&quot😉
}
//-->
</SCRIPT>

heres a simple script that opens up pop up windows. just set the sizes to whatever you want and put an onclick=&quot;openname()&quot; in the input or href tag if you use a button or link. if you want it to up when the page loads, just get rid of the function and leave the

open(&quot;pagename.html&quot;,&quot;Windowname&quot;,&quot;WIDTH=700,HEIGHT=340&quot😉

part in the script.

hope this helps
 
Back
Top