• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

Go to button

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
axl13
Asked:
axl13
  • 7
  • 4
1 Solution
 
leakim971PluritechnicianCommented:
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
 
axl13Author Commented:
Where whould I enter this code... And am I already calling it...
0
 
leakim971PluritechnicianCommented:
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
What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.

 
axl13Author Commented:
Does not do anything,,, I am not able to type anything in the test box
0
 
leakim971PluritechnicianCommented:
did you try the test page?
0
 
axl13Author Commented:
from http://jsfiddle.net/XXw7M/

yes, it still did not work
0
 
axl13Author Commented:
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
 
leakim971PluritechnicianCommented:
>from http://jsfiddle.net/XXw7M/
>yes, it still did not work

it work for me :
leakim971-501777.flv
0
 
axl13Author Commented:
I keep getting:


The address is not valid...

I type http://www.google.com
0
 
axl13Author Commented:
FYI,

IT works... Thanks
0
 
axl13Author Commented:
Fast responds... Thanks
0

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now