?
Solved

Go to button

Posted on 2011-09-20
11
Medium Priority
?
506 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
[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
  • 7
  • 4
11 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 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
Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

752 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