Solved

Javascript function problem

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Angular - ng-if worked but why like this? 5 31
c# LinkButton OnClientClick 2 34
angular2 2 way binding on load 7 38
wordpress display sub menu only when click 12 18
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

914 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

14 Experts available now in Live!

Get 1:1 Help Now