Solved

Go to button

Posted on 2011-09-20
11
496 Views
Last Modified: 2012-05-12
I am having users type in a url in a text box... When a user clicks a button, the users will go to the site entered into the test box... Here is part of the code:

     <form name="directForm" method="post" action="http://" onsubmit="setTarget(this);">

        <table cellspacing="0" cellpadding="0" border="0" class="addressbar">
           <tr>
               <td valign="middle" style="padding-left: 5px; padding-bottom: 3px;" nowrap>
                   <span class="intranetbodytext" style="">
                       <b>Intranet Address:</b>
                   </span>
               </td>
               <td width="325" style="padding-top: 5px; padding-bottom: 4px;" valign="middle">


           <input type="text" name="address" maxlength="2082" value="Type a URL here" onfocus="clearDefault(this);this.className='bodytext';"                

                disabled="disabled" style="width: 325px;" class="intranetaddress">

               </td>
               <td  style="padding-top: 2px; padding-left: 5px;" valign="middle" nowrap>
                <input type="submit" name="go" value="GO" onclick="submitDirectAccess( this.form );" disabled="disabled" class="gobutton">
               </td>
               <td valign="middle" style="padding-bottom: 3px;" nowrap>

              </td>
           </tr>
         </table>
      </form>
0
Comment
Question by:axl13
  • 7
  • 4
11 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36567010
try : http://jsfiddle.net/XXw7M/
window.onload = function() {
    document.getElementsByName("go")[0].onclick = function() {
        alert("going to :" + document.getElementsByName("address")[0].value);
        setTimeout(function() { location.href = document.getElementsByName("address")[0].value; }, 200);                 }
}

Open in new window

0
 

Author Comment

by:axl13
ID: 36567034
Where whould I enter this code... And am I already calling it...
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36567058
put this in the head section :

<script>
window.onload = function() {
    document.getElementsByName("go")[0].onclick = function() {
        alert("going to :" + document.getElementsByName("address")[0].value);
        setTimeout(function() { location.href = document.getElementsByName("address")[0].value; }, 200);                 }
}
</script>

Open in new window

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:axl13
ID: 36567531
Does not do anything,,, I am not able to type anything in the test box
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36567536
did you try the test page?
0
 

Author Comment

by:axl13
ID: 36568493
from http://jsfiddle.net/XXw7M/

yes, it still did not work
0
 

Author Comment

by:axl13
ID: 36568495
Here is the entire file:


<HTML>
   <HEAD>
      <TITLE> NYSDOH WorkPlace SSL </TITLE>
      <script>
         window.onload = function() {
             document.getElementsByName("go")[0].onclick = function() {
             alert("going to :" + document.getElementsByName("address")[0].value);
             setTimeout(function() { location.href = document.getElementsByName("address")[0].value; }, 200);                 }
           }
      </script>
   </HEAD>

   <BODY BGCOLOR="#ececec"><FONT size="3" color="darkblue">
      <P><image SRC="NYSDOH.bmp" width="100%"></P>
      <P ALIGN="LEFT"><B><FONT size="6">Department of Health<BR>
      <FONT size="4"><I>Information for a Healthy New York</I>
      </FONT></B></P>
      </FONT>
      <HR size="5" width="95%">
      <H1 ALIGN="center">NYSDOH WorkPlace</H1>

      <P>
      NYSDOH WorkPlace provides secure access to network resources on your intranet. To
        access a resource, click its name from the list below. For help, email
        help@health.state.ny.us
      </P>
      <P></P>
      <H2><U>Remote Access Has A New Look</U></H2>
      <P>
        In an effort to increase user experience and to support access from mobile devices (
        ipad, itouce, and iphone), the remote access platform has changed. As a result of this
        change, users will be required to authenticate twice when logging into Lotus Notes,
        which will be temporary as work is being done to resolve this
      </P>
      <P></P>
      <HR size="5" width="95%">
      <P></P>
      <H3><I> Web Bookmarks </I></H3>
      <P></P>
      <P>
         <A href="http://applevip.health.state.ny.us/mailjump.nsf">Notes E-Mail (High-speed connection)</A><BR>
         <A href="http://applevip.health.state.ny.us/mailjump2.nsf">Notes E-Mail (Low-speed connection)</A><BR>      
         <A href="http://applevip.health.state.ny.us/mailjump3.nsf">Notes E-Mail (Ultra-mobile connection)</A><BR>
         <A href="http://applevip.health.state.ny.us/asahomepage.nsf">Browse for a Lotus Notes Database</A><BR>
         <A href="https://latsweb.health.state.ny.us">LATS</A><BR>
         <A href="https://travel.health.state.ny.us">Travel</A><BR>
         <A href="https://password.health.state.ny.us">Enterprise Password</A><BR>
         <A href="https://portal.health.state.ny.us">NYSDOH Intranet Websites</A><BR>
      </P>
      <BR>


      <form name="directForm" method="post" action="https://email.health.state.ny.us/workplace/access/exec/direct" onsubmit="setTarget(this);">

        <table cellspacing="0" cellpadding="0" border="0" class="addressbar">
           <tr>
               <td valign="middle" style="padding-left: 5px; padding-bottom: 3px;" nowrap>
                   <span class="intranetbodytext" style="">
                       <b>Intranet Address:</b>
                   </span>
               </td>
               <td width="325" style="padding-top: 5px; padding-bottom: 4px;" valign="middle">


           <input type="text" name="address" maxlength="2082" value="Type a URL here" onfocus="clearDefault(this);this.className='bodytext';"                

                disabled="disabled" style="width: 325px;" class="intranetaddress">

               </td>
               <td  style="padding-top: 2px; padding-left: 5px;" valign="middle" nowrap>
                <input type="submit" name="go" value="GO" onclick="submitDirectAccess( this.form );" disabled="disabled" class="gobutton">
               </td>
               <td valign="middle" style="padding-bottom: 3px;" nowrap>

              </td>
           </tr>
         </table>
      </form>


    </BODY>
</HTML>
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36568527
>from http://jsfiddle.net/XXw7M/
>yes, it still did not work

it work for me :
leakim971-501777.flv
0
 

Author Comment

by:axl13
ID: 36568550
I keep getting:


The address is not valid...

I type http://www.google.com
0
 

Author Comment

by:axl13
ID: 36568610
FYI,

IT works... Thanks
0
 

Author Closing Comment

by:axl13
ID: 36568687
Fast responds... Thanks
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

816 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

6 Experts available now in Live!

Get 1:1 Help Now