The Straight Dope

Go Back   Straight Dope Message Board > Main > General Questions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2004, 10:51 PM
LouisB LouisB is offline
Charter Member
 
Join Date: Apr 2000
Location: Seminole, FL
Posts: 8,024
JavaScript question

I'm working on a webpage that will use a JavaScript drop down menu. If I select a valid value, the new webpage pops up with no problems. If I select a value for which no new page exists, I get the old familiar "Page Cannot Be Displayed" error. I would really like to have my own error page pop up, but I don't know what to change in the JavaScript---maybe I can't do it at all.

This part of the JavaScript is in the Head portion: <script language="JavaScript">
function doMoveBrowser(form) {window.location.href = form.gomenu.options[getSelectedValue()].value; } function getSelectedValue() {return document.goform.gomenu.selectedIndex }</script>

The part that is in the Body is pretty long; but the first few lines are:<script language="JavaScript">function goBrowser(form) {document.location.href = form.gomenu.options[form.gomenu.selectedIndex].value;
form.gomenu.selectedIndex=0;} </script>

<form name="form" method="post">
<div align="center">
<select name="gomenu" size="1" onChange="goBrowser(this.form)">
<option selected>Select Part Number</option>

Is this enough information for someone to answer my question? I believe this Script, or a very similar one, is in widespread use, for what that's worth.

I would appreciate any inputs.
__________________
LouisB
Timor Mortis Conturbat Me
Reply With Quote
Advertisements  
  #2  
Old 05-05-2004, 11:13 PM
caphis caphis is offline
BANNED
 
Join Date: Feb 2004
Posts: 818
Unless you tell the script which pages do not exist yet, then there's no way to do this using JavaScript. You'll need to use a custom 404 page, server side.
Reply With Quote
  #3  
Old 05-06-2004, 01:09 AM
Shalmanese Shalmanese is offline
Charter Member
 
Join Date: Feb 2001
Location: San Francisco
Posts: 5,607
are you re-directing to internal webpages only or any type of page?
Reply With Quote
  #4  
Old 05-06-2004, 06:21 AM
LouisB LouisB is offline
Charter Member
 
Join Date: Apr 2000
Location: Seminole, FL
Posts: 8,024
Quote:
Originally Posted by Shalmanese
are you re-directing to internal webpages only or any type of page?
At the moment, the pages are just being written. I hope to have them on a website eventually.
__________________
LouisB
Timor Mortis Conturbat Me
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:54 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Send questions for Cecil Adams to: cecil@chicagoreader.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Publishers - interested in subscribing to the Straight Dope?
Write to: sdsubscriptions@chicagoreader.com.

Copyright © 2013 Sun-Times Media, LLC.