PDA

View Full Version : List/menu link values


sturle
11-23-2004, 08:37 AM
Dear all,

Im trying to find a way in which the links placed in a list/menu, opens up in a new window, with these specific values:

- width: 800
- lenght: 700
- left: 200
- resizable:yes
- scrollbars: yes
- top: 80

For a pop-up it would be:
<a href="#" onClick="window.open('yoururl.htm','title of a window','width=800;length=700;left=200;resizable=y es;scrollbars=yes;top=80;'')">Open in a new window</a>

However, I dont understand where I can insert these values in a list/menu script as below:

In 'Head':
<script language="JavaScript">

// Set the target window or frame
// _top opens in the same window
// _blank opens in a new window
// Use the frame name to open to a frameset target
var theTarget = "_blank";

function goThere(){
if(!document.theForm.theMenu.selectedIndex==""){
window.open(document.theForm.theMenu.options[document.theForm.theMenu.selectedIndex].value,theTarget,"");}}
</script>

In 'Body':
<form name="theForm">
<select name="theMenu" onChange="goThere()">
<option selected value="">Select a city
<option value="http://www.bbc.co.uk/weather/5day.shtml?world=0065" selected>Rome
(Italy) </option>
</select>
</form>

Does anyone have any suggestions?

As always; thanks for any help!

Best regards

ellisd5
11-23-2004, 11:54 AM
Really don't understand your problem you seem to have the code already done, just add the window properties to it...

function goThere(){
if(!document.theForm.theMenu.selectedIndex==""){
var url = document.theForm.theMenu.options[document.theForm.theMenu.selectedIndex].value;
var newWin = window.open(url, "windowName", "width=800,length=700,left=200,resizable=yes,scrollbars=yes,top=80");
}
}

sturle
11-23-2004, 12:52 PM
Dear hharchester,

thanks for your help! My JS knowledge is quite limited, consequently I didnt work it out myself, eventhough it was right under my own nose...

Thanks!