Avatar of packet-man
packet-man

asked on 

javascript go to URL script

Hello,

I need some help re-writing a script for our knowledge base, I want the user to be able to press enter via the keyboard instead of the Query button to quickly navigate to the desired solution.

When the user clicks enter the on keyboard, it opens up the following page.
http://packetman.com.au/kb/?Dest=1 but I want the user to go to http://packetman.com.au/kb/entry/1/

Here is the code.

How would I do this?
function GoToURL(j) {
  window.status=('Extracting')
  
var URLis;
 URLis = document.URLframe.Dest.value
  
   if (URLis == "" || URLis.length <= 0)
           { 
     j.value = "Try Again"
      alert('You must enter valid Article ID');
         window.status=('Missing data or Invalid. Try again?.')
           } 
    else
        {
 j.value = "Finding KB" + URLis   
 var location=("http://packetman.com.au/kb/entry/" + URLis +"/");
         this.location.href = location;
window.status=('Connecting to ' + URLis + '  Please wait........');
        }
        }
 
<form name="URLframe"> 
<b>KB Number</b> 
<input type="TEXT" name="Dest" size="5" maxlength="5">
<input type="Button" name="Go to" value="Query" onClick="GoToURL(this)">
</form>

Open in new window

JavaScriptProgramming Languages-Other

Avatar of undefined
Last Comment
packet-man
ASKER CERTIFIED SOLUTION
Avatar of corey_mcm
corey_mcm
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of packet-man
packet-man

ASKER

OK. Many thanks. I'll check out that site and see what I can do.

Just have to figure out how it all fits together.


Avatar of packet-man
packet-man

ASKER

Can I have some ideas how I would integrate into the current script?

Cheers,
Daniel
Avatar of packet-man
packet-man

ASKER

Awesome. I got it to work.
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo