Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-14-2009, 11:30 AM   PM User | #1
Davidasp
New Coder

 
Join Date: Jul 2009
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
Davidasp is an unknown quantity at this point
Exclamation Firefox ignores my javascript PROMPT dialog box..... HELP!

Hey there guys, i've been having a problem lately and i can't seem to find any solution for that. I know you guys could help me, so here it goes:

I have a javascript promt box (as you can see in the code below) it works perfectly fine with internet explorer however it's NOT working in firefox. I tried everything i can think of, but still its not working!

Please check the code below and give me the solution for firefox. Thank You!



<%@LANGUAGE="VBSCRIPT" CODEPAGE="28592"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Choose Your Language</title>
<script language="javascript" type="text/javascript">
function checklang()
{
var lang = prompt('Choose A Language:'+'\n' + "(Ex: Armenian, Arabic, English, French, Greek, Russian)",'English');
if (lang==null || lang=="")
{lang=""; return;}

if (lang=="Armenian" || lang=="Arabic" || lang=="English" || lang=="French" || lang=="Greek" || lang=="Russian")
{location.href = "sermon-section.asp?lang="+lang};
else
location.reload();
}
</script>
</head>

<body>

<a href="#" onclick="checklang()">Choose Your Language</a>

</body>
</html>
Davidasp is offline   Reply With Quote
Old 08-14-2009, 11:57 AM   PM User | #2
Amphiluke
Regular Coder

 
Amphiluke's Avatar
 
Join Date: Jul 2009
Posts: 312
Thanks: 3
Thanked 89 Times in 89 Posts
Amphiluke is on a distinguished road
Quote:
Code:
if (lang=="Armenian" || lang=="Arabic" || lang=="English" || lang=="French" || lang=="Greek" || lang=="Russian")
{location.href = "sermon-section.asp?lang="+lang};
else
location.reload();
}
Remove the semicolon...
__________________
I am still learning English
Amphiluke is offline   Reply With Quote
Users who have thanked Amphiluke for this post:
Davidasp (08-14-2009)
Old 08-14-2009, 12:12 PM   PM User | #3
Davidasp
New Coder

 
Join Date: Jul 2009
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
Davidasp is an unknown quantity at this point
Thumbs up Thank You!

I'm feeling sooooo stupid, how couldn't i see that

Anyway thank you man !! Although it was a stupid thing i didn't notice, but you saved me
i also gave you a reputation!

Last edited by Davidasp; 08-14-2009 at 12:14 PM..
Davidasp is offline   Reply With Quote
Old 08-14-2009, 04:30 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,038
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
This is a good example of the kind of bug which is likely to arise when braces and semi-colons are not properly positioned, or braces omitted. Far better thus:-


Code:
if (lang=="Armenian" || lang=="Arabic" || lang=="English" || lang=="French" || lang=="Greek" || lang=="Russian") {
location.href = "sermon-section.asp?lang="+lang;
}
else {
location.reload();
}
}
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:19 PM.


Advertisement
Log in to turn off these ads.