Click to See Complete Forum and Search --> : Why isn't this working?
Bootsman123
04-29-2003, 09:56 AM
It should open a new window the chosen value as 'radioId'. Can anybody tell me why this isn't working.
<html>
<head>
<script language="JavaScript">
<!--
function changeRadio(link) {
var radioId = link.options[link.selectedIndex].value;
tunerWindow = window.open("tunerpop.php?id="+radioId,"Tuner","left=100,top=100,screenX=100,screenY=100,width=230,height=110");
}
// -->
</script>
<title></title>
</head>
<body>
<form name="tuner">
<select name="radio" class="inputText" onChange="changeRadio(this);">
<option value="0">Kies een station</option>
<option value="1">Radio 538</option>
<option value="2">3FM</option>
<option value="3">Sky Radio</option>
<option value="4">Yorin FM</option>
<option value="5">Radio Veronica</option>
<option value="6">Kink FM</option>
<option value="7">Radio Donna</option>
<option value="8">Nova classic rock</option>
<option value="9">Top Radio</option>
<option value="10">Baja Radio</option>
<option value="11">Classic FM</option>
<option value="12">Noordzee FM</option>
<option value="13">DanceNet</option>
</select>
</body>
</html>
http://www.greatcorners.com/~bbootsma/tuner/tuner.php
khalidali63
04-29-2003, 10:36 AM
Make sure this line
tunerWindow = window.open("tunerpop.php?id="+radioId,"Tuner"," left=100,top=100,screenX=100,screenY=100,width=230,height=110");
is one straight line...
DaiWelsh
04-29-2003, 11:27 AM
It helps us all if you post your actual code where possible. What you posted works, but the code on the link does not.
The second parameter (window name) to the window.open call does not like the '.' it works fine if you remove it.
HTH,
Dai
Bootsman123
04-29-2003, 12:16 PM
First: it is on a straight line, not in this forum, but it is in my code.
Second: it's still not working even when i delete the '.'.
<html>
<head>
<link rel=stylesheet type="text/css" href="../main/pages/tekst.css">
<script language="JavaScript">
<!--
function changeRadio(link) {
var radioId = link.options[link.selectedIndex].value;
tunerWindow = window.open("tunerpop.php?id="+radioId,"Greatcorners.com","left=100,top=100,screenX=100,screenY=100,width=230,height=110");
}
// -->
</script>
<title>Greatcorners.com</title>
</head>
<body>
<form name="tuner">
<select name="radio" class="inputText" onChange="changeRadio(this);">
<option value="0">Kies een station</option>
<option value="1">Radio 538</option>
<option value="2">3FM</option>
<option value="3">Sky Radio</option>
<option value="4">Yorin FM</option>
<option value="5">Radio Veronica</option>
<option value="6">Kink FM</option>
<option value="7">Radio Donna</option>
<option value="8">Nova classic rock</option>
<option value="9">Top Radio</option>
<option value="10">Baja Radio</option>
<option value="11">Classic FM</option>
<option value="12">Noordzee FM</option>
<option value="13">DanceNet</option>
</select>
</form>
</body>
</html>
Compare the quotes:
tunerWindow = window.open("tunerpop.php?id="+radioId+","Greatcorners.com","left=100,top=100,screenX=100,screenY=100,width=230,height=110");
Bootsman123
04-29-2003, 01:23 PM
It still isn't working. I've tried all the comments you people posted, but still it doesn't works. If I don't get an error on the "onChange" line then I get an error on the "var radioId" line or the "tunerWindow" line. I'm becoming desperate.
http://www.greatcorners.com/~bbootsma/tuner/tuner.php
Wait, your original code should work. I just look at it (closer this time), and found that it should work....
DaiWelsh
04-29-2003, 04:55 PM
You now have
window.open('tunerphp.php?id='+radioId+,'Greatcorners.com','left=100,top=100,screenX=100,screenY=100 ,width=230,height=110');
which has two errors, the one I originally mentioned and the extra + left hanging before the first comma. This should work.
window.open('tunerphp.php?id='+radioId,'Greatcorners','left=100,top=100,screenX=100,screenY=100,widt h=230,height=110');
Dai
@Jona: yes, the code a she posted it here should have worked, but the code at that link was different and I imagine that was the version that was actually failing ;)
Bootsman123
04-29-2003, 05:01 PM
Thanks a lot DaiWelsh, it works! I'm almost euphoric right now...
Originally posted by DaiWelsh
@Jona: yes, the code a she posted it here should have worked, but the code at that link was different and I imagine that was the version that was actually failing ;)
It gets so confusing when dealing with all of those quotes. And especially the fact that she said it didn't work and hadn't even tried it yet--that one really threw me off. :)