Javascript pick list returns File Not Found error

Posted on 2008-11-18
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
    LVL 75

    Accepted Solution

    JS is case sensitive
    .value instead of .Value
    LVL 75

    Expert Comment

    by:Michel Plungjan
    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

    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
    Suggestion: test in Firefox - the javascript console would most likely tell you the error

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
    Article by: DanRollins
    This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (, we'll extend the program by adding a depth-…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    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…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now