?
Solved

Javascript function problem

Posted on 2013-12-04
3
Medium Priority
?
331 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
[X]
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
3 Comments
 
LVL 9

Accepted Solution

by:
Trenton Knew earned 1000 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 1000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Suggested Courses

764 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