Link to home
Start Free TrialLog in
Avatar of Elroy Taulton
Elroy TaultonFlag for United States of America

asked on

Call Two Different Weblinks for one Java File

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.
Avatar of for_yan
for_yan
Flag of United States of America image

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
Avatar of Elroy Taulton

ASKER

So for instance, how would I list the following two links?

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

http://server.com/idm/hms/ca12/hms/page/jsp/ViewAllUserEquipmentRequestHistoryController.jsp?searchFilterValue=PurchaseOrderNumber&poValue=<PONUM>

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.


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
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial