Solved

Go to button

Posted on 2011-09-20
11
497 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 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
Industry Leaders: 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!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
html input 8 56
Javascript 2 38
Can't get cursor to change 3 16
I need to make my existing Javascript Menu conditional within my ASP.Net/C# Application 32 35
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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 …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

740 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