File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Multiple Javascript commands form onClick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Multiple Javascript commands form onClick" Watch "Multiple Javascript commands form onClick" New topic
Author

Multiple Javascript commands form onClick

Judy Herilla
Ranch Hand

Joined: Jan 05, 2001
Posts: 89
Within an onClick, is it possible to run many Javascript commands?
I have...
<A HREF="#ABC" onClick="javascript:window.open('http://pest/SP/VG?PID=PO_MTD_Desc.html','MetricLocation2', 'scrollbars=no,menubar=no,width=400,height=100')">
This helps me get a pop-up window...but I woudl like to ensure it gets the focus, such as when it has been minimized. I know that if I did
newWindow = window.open(...
and
newWindow.focus() that this would work, ut I am not sure how to fit this into the submit onclick.


SCPJ2
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
That's why JavaScript lets you define functions:


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
You can also put multiple javascript commands into an HTML element by using ';' to separate them, like this:

but I prefrer Frank's solution, as it makes for more readable script.
[This message has been edited by Bodie Minster (edited May 09, 2001).]
Judy Herilla
Ranch Hand

Joined: Jan 05, 2001
Posts: 89
Bodie,
I had found your solution before I read both of your responses.
I like it because the portal framework I am using is tricky with scripts, and using the semicolon is simple and straightforward!
Thanks to both of you!!
Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
Of course, the other thing you can do is have the onClick call a function which in turn acts like a controller and calls multiple action functions.
------------------
I'm a soldier in the NetScape Wars...
Joel


Wait a minute, I'm trying to think of something clever to say...<p>Joel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Javascript commands form onClick
 
Similar Threads
reloading a page
Getting "Unspecified" Java Script Error When trying to save a File.
make the hyperlink to set the values in an action form
Going back to the previous page
Href with onClick