Solved

Call Two Different Weblinks for one Java File

Posted on 2011-09-21
4
304 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

726 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