Solved

Call Two Different Weblinks for one Java File

Posted on 2011-09-21
4
302 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:HMSImage
  • 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:HMSImage
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 500 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
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…

808 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