469,315 Members | 1,643 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,315 developers. It's quick & easy.

help on window.location

hi,

i do have dropdown box that contains several items with attached
links:

<select class="text" onchange="linker()" name="menu1">
<option value="#" selected="selected">--- Countries
---</option>
<option
value="#">Argentina</option>
<option value="#">Australia</option>
<option value="#">Brazil</option>
<option value="#">Canada</option>
<option value="#">China</option>
<option value="http://
www.mypage.com"class="textRed">*France</option>

the linker() function:

function linker(){
var s=menu1.options[menu1.selectedIndex].value;
if(s !== '#'){
window.location.href = s;
}

this works perfectly IE but in doesnt work in firefox. can someone pls
tell me what is wrong?

tnx

May 5 '07 #1
7 15788
shotokan99 said the following on 5/4/2007 11:31 PM:
hi,

i do have dropdown box that contains several items with attached
links:

<select class="text" onchange="linker()" name="menu1">
onchange="linker(this.value)"

<snip>
function linker(){
function linker(theValue){
if(theValue !== "#"){

}
}
var s=menu1.options[menu1.selectedIndex].value;
if(s !== '#'){
window.location.href = s;
}

this works perfectly IE but in doesnt work in firefox. can someone pls
tell me what is wrong?
You are relying on the IE behavior of making names and ID atttributes
global variables (menu1) whereas Firefox doesn't.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 5 '07 #2
ah ok. so what is the best way to do it?

May 7 '07 #3
shotokan99 said the following on 5/6/2007 10:04 PM:
ah ok. so what is the best way to do it?
Best way to do what?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 7 '07 #4
Randy Webb wrote:
shotokan99 said the following on 5/6/2007 10:04 PM:
>ah ok. so what is the best way to do it?

Best way to do what?
I think (s)he was talking about the best way to lure a blond
nymphomaniac to a deserted island.

Not totally sure as the topic is throwing me, and I cannot remember the
content without adequately quoted/trimmed um... content.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
May 7 '07 #5
if this function is specific for ie:
function linker(){
var s=menu1.options[menu1.selectedIndex].value;
if(s !== '#'){
window.location.href = s;
}

how to do it with firefox?

May 7 '07 #6
-Lost said the following on 5/7/2007 1:15 AM:
Randy Webb wrote:
>shotokan99 said the following on 5/6/2007 10:04 PM:
>>ah ok. so what is the best way to do it?

Best way to do what?

I think (s)he was talking about the best way to lure a blond
nymphomaniac to a deserted island.
Simple. Tell her no blonds allowed. She will show up to find out why not :-)
Not totally sure as the topic is throwing me, and I cannot remember the
content without adequately quoted/trimmed um... content.
I would tell you the topic but I would have to quote it to show you first :)

Here is one though:

Answer: Google Groups

I would tell you the question but I didn't quote it <g>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 7 '07 #7
shotokan99 said the following on 5/7/2007 5:27 AM:
if this function is specific for ie:
It isn't specific for IE. It is specific for any browser that makes a
name/id a global variable. Read the FAQ on a way to correct it (It has
an entry of its own, even though the entry pushes the crutch of gEBI).
function linker(){
var s=menu1.options[menu1.selectedIndex].value;
if(s !== '#'){
window.location.href = s;
}
how to do it with firefox?
Re-write it. Either using the tidbits I gave you, consult the group FAQ
(4.41) or try not quoting again.

But, how many times do you think people are going to look up old posts
in order to find out what you are asking about because you didn't quote
what you were replying to? I know it is "in your face" with Google
Groups but not everybody uses GG, some use a real newsreader.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 7 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by martingerber | last post: by
2 posts views Thread by Jackson Yap | last post: by
19 posts views Thread by Darren | last post: by
33 posts views Thread by Todd | last post: by
9 posts views Thread by Robert Porter | last post: by
1 post views Thread by Michael D. Reed | last post: by
5 posts views Thread by althafexcel | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.