Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Javascript function problem

Posted on 2013-12-04
3
327 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 20

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

840 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