Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I specify window size & options in a javascript?

Status
Not open for further replies.

corbitt

MIS
Feb 22, 2002
73
0
0
US
I would like to modify the script below to open a new window with a specific size. I modified the function "go" as follows:

BEFORE:

function go(){
location=temp.options[temp.selectedIndex].value
}

AFTER:

function go(){
window.open(temp.options[temp.selectedIndex].value)
}

The window.open mod works, but I don't know how to set the window width & height, scrollbar availability, & menu availability.

Thank you for helping.

Jeremy

*************** CODE *******************

<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Technology Sites</option>
<option>News Sites</option>
<option>Search Engines</option>
</select>
<select name="stage2" size="1">
<option value=" Kit</option>
<option value="<option value=" News</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>

<script>
<!--

var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group=new Array()

group[0][0]=new Option("JavaScript Kit","group[0][1]=new Option("News.com","group[0][2]=new Option("Wired News","
group[1][0]=new Option("CNN","group[1][1]=new Option("ABC News","
group[2][0]=new Option("Hotbot","group[2][1]=new Option("Infoseek","group[2][2]=new Option("Excite","group[2][3]=new Option("Lycos","
var temp=document.doublecombo.stage2

function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options=new Option(group[x].text,group[x].value)
}
temp.options[0].selected=true
}

function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>

</form>

*************** /CODE *******************
 
open("new.html","new", "toolbar=no,menubar=no,width=200,height=200,resizable=yes")


 
Thanks! I tried what you recommended, but the value of -- temp.options[temp.selectedIndex].value -- is not working in place of "new.html" in your example.

Is there a way I can make this work? Thanks. Jeremy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top