File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Javascript commands form onClick

 
Judy Herilla
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's why JavaScript lets you define functions:
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 301
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic