Call Two Different Weblinks for one Java File

Posted on 2011-09-21
Medium Priority
Last Modified: 2012-05-12
I have the need to call two separate weblinks from one java script file.  Is this possible?
The first link will initiate the login screen.  The second link will pass a variable that will retrieve a specific page (document).

I want to embed this in one file and then be able to pass the variable to the java script file when I run it.  If java script is not the way to go but it is doable, please let me know that also.
Question by:Elroy Taulton
  • 3
LVL 47

Expert Comment

ID: 36574988
Sure, there is no reason why you cannot have two functions in your javascript - and one would go
to one screemn, another - to another screen
For example below I show how you can have two buttoins which call differnt javscript functions
and inside each yone you can direct to different lnks, say using
location= ...link here...
statment of JavaScript

<input type="button" onClick="goToLogin()" value="Go To Login"></tr>

<input type="button" onClick="goToAnotherPage()" value="Go to another page"></tr>

Open in new window

You can do it just with simple links also

This question is  related to JavaScript but should not beling to Java Programming Language

Author Comment

by:Elroy Taulton
ID: 36575229
So for instance, how would I list the following two links?



PONUM is a variable that I will be passing to the script.  But I want the second link to be performed automatically, without additional user input; if that makes sense.

LVL 47

Expert Comment

ID: 36575264

Waht you may do - you can have a form and
put  the second link as its action.

Then when yuser just presses enter it will go there.
For the first link you cna make a button within your html page as  I wrote above

and then you shoule add a small javscript function in the head of your page that
woul put your first link as location

I''ll post a simple examnple of such function
LVL 47

Accepted Solution

for_yan earned 2000 total points
ID: 36575396

Before the body of your page
put this function:
function goToAnotherPage(){

location="http://server.com/idm/hms/ca12/index.jsp?task.tag=HMSSearchHWSWRequests" ;

Open in new window

and in the body :

<input type="button" onClick="goToAnotherPage()" value="Go to another page"></tr>

Open in new window

and another URL should go to the action of your form
and then there will be Submit button of the form
and it will go to that action URL also when yuser just presses enter

and to the sceond one only if the user presses this button Go to another page

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

619 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