Solved

Javascript function problem

Posted on 2013-12-04
3
321 Views
Last Modified: 2013-12-04
I have a page with two identical JS functions, go1() and go2(). The first one works correctly, but the second does not display the corresponding dropdown. I can't see what could be causing this. Could somebody let me know if they see the problem?

<script language="JavaScript" type="text/javascript">
function go1(){
if (document.selecter1.select2.options[document.selecter1.select2.selectedIndex].value != "none") {
location = document.selecter1.select2.options[document.selecter1.select2.selectedIndex].value
             }
     }
</script>
<script language="JavaScript" type="text/javascript">
function go2(){
if (document.selecter3.select4.options[document.selecter3.select4.selectedIndex].value != "none") {
location = document.selecter3.select4.options[document.selecter3.select4.selectedIndex].value
             }
     }
</script>
</head>
<body>
<p>&nbsp;<p>&nbsp;<p>&nbsp;
<center><H1><font face="Arial, Helvetica">Page Name/font></H1></center><p>
<p><p><p>
<table align=center width="15%" border=0>
  <tr>
    <td>
<script language="JavaScript" type="text/javascript">
<!--
document.write('<form name="selecter1"><select name="select2"');
document.write('<option value=none>--Select High Level View--');
document.write('<option value=filename.html>Name of Page');
document.write('</select>');
document.write('<input type=button value=Go onclick=go1()>');
document.write('</form>');
// end hiding contents -->
</script>
    </td>
  </tr>
  <tr>
    <td>
<script language="JavaScript" type="text/javascript">
<!--
document.write('<form name="selecter3"><select name="select4"');
document.write('<option value=none>--Select Filter--');
document.write('<option value=aip_filename.html>Page Name');
document.write('<input type=button value=Go onclick=go2()>');
'document.write('</form>');
// end hiding contents -->
</script>
</td>
</tr>
</table>

Open in new window

0
Comment
Question by:dgmoore1
3 Comments
 
LVL 9

Accepted Solution

by:
Trenton Knew earned 250 total points
ID: 39696639
Line 43.... delete the apostrophe at the beginning.  your closing form tag is being commented out.
0
 
LVL 19

Assisted Solution

by:n2fc
n2fc earned 250 total points
ID: 39696640
Get rid of the extra ' at the beginning of line 43 above
0
 

Author Closing Comment

by:dgmoore1
ID: 39696755
My  eyes are getting too old for this! You're both exactly right - thanks a lot
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 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