Javascript pick list returns File Not Found error

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

Who is Participating?
Michel PlungjanConnect With a Mentor IT ExpertCommented:
JS is case sensitive
.value instead of .Value
Michel PlungjanIT ExpertCommented:
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

dgmoore1Author Commented:
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!!
Michel PlungjanIT ExpertCommented:
Suggestion: test in Firefox - the javascript console would most likely tell you the error
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.