JavaScript in Netscape

They have: 40 posts

Joined: Jul 2001

I am running this script as a dummy login application:

<script>
function getit() {
if (document.former.IDS.value == "crosby") {location.replace('crosby/profile.html')}
else if (document.former.IDS.value == "sample"){location.replace('sample/profile.html')}
else if (document.former.IDS.value=="drest"){location.replace('drest/profile.html')}
else if (document.former.IDS.value=="east"){location.replace('east/profile.html')}
else if (document.former.IDS.value=="noonan"){location.replace('reporting/profile.html')}
else {location.replace('errorlogin.html')}

}
</script>

It works fine in IE but keeps reloading the same page when I attempt it in Netscape. What could be the problem?

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

Not knowing what you mean by "the same page"....
if else clauses occasionally cause browser confusion. So, kill the braces around the 'location.replace...' code and place them around the 'else's:

if (document.former.IDS.value == "crosby")
location.replace('crosby/profile.html')
else
{
if (document.former.IDS.value == "sample")
location.replace('sample/profile.html')
else
{
if (document.former.IDS.value=="drest")
location.replace ('drest/profile.html')
.....etc....

}}}}

Vinny

Where the world once stood
the blades of grass cut me still

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Hey Vinny welcome back!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.