Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Call Two Different Weblinks for one Java File

Posted on 2011-09-21
4
Medium Priority
?
313 Views
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.
0
Comment
Question by:Elroy Taulton
[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
  • 3
4 Comments
 
LVL 47

Expert Comment

by:for_yan
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
0
 

Author Comment

by:Elroy Taulton
ID: 36575229
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.

0
 
LVL 47

Expert Comment

by:for_yan
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
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 36575396


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

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

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
0

Featured Post

Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

721 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