Javascript pick list returns File Not Found error

Posted on 2008-11-18
Medium Priority
Last Modified: 2012-05-05
I have a simple JS pick list (included below) that is modeled on another I wrote that works correctly. When I select an item in the list and click 'Go', I get a page with 'file:///.../undefined' displayed in the location bar in IE and Firefox; in Firefox the error console shows:
Error: uncaught exception: [Exception... "File error: Not found"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: file:///F:/MSProject%20Web%20Page/test2.html :: go :: line 9"  data: no]
The target file is in the directory in question, but the error message suggests that something is wrong with the code. I need to solve this ASAP for a deliverable that is becoming overdue. Any help would be appreciated.
This is a test pick list:
<script language="JavaScript" type="text/javascript">
function go(){
if(document.selecter.select1.options[document.selecter.select1.selectedIndex].Value !="none"){
location = document.selecter.select1.options[document.selecter.select1.selectedIndex].Value
<script language="JavaScript" type="text/javascript">
document.write('<form name="selecter"><select name="select1" size=1>');
document.write('<option value ="test.html">Test Doc');
document.write('<input type="button" Value="Go" onclick="go()">');
//end hiding contents-->

Open in new window

Question by:dgmoore1
  • 3
LVL 75

Accepted Solution

Michel Plungjan earned 2000 total points
ID: 22984224
JS is case sensitive
.value instead of .Value
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22984272
I would write it like this

<script language="JavaScript" type="text/javascript"><!--
function go(theForm){ 
  var loc = theForm.select1.options[theForm.select1.selectedIndex].value;
  if (loc!="none") window.location = loc;
  return false;
window.onload=function() {
// --></script>
This is a test pick list:
<script language="JavaScript" type="text/javascript"><!--
var text = '<form onSubmit="return go(this)">'+
'<select name="select1" size=1>'+
'  <option value ="none">Please select</option>'+
'  <option value ="test.html">Test Doc</option>'+
'<input type="submit" value="Go" />'+
// -->

Open in new window


Author Closing Comment

ID: 31517823
I knew it was something simple - I'm editing in Notepad and it's hard to spot U/C "V" vs. L/C "v", especially with eyes as old as mine.  Many thanks!!
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22985451
Suggestion: test in Firefox - the javascript console would most likely tell you the error

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article will show, step by step, how to integrate R code into a R Sweave document
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question