Link to home
Start Free TrialLog in
Avatar of AphX
AphX

asked on

Make function call inside body instead of onLoad

Hi Experts!

I'm trying to use this code snippet and adjust it to fit my needs:

http://www.tek-tips.com/faqs.cfm?fid=5889

He is using body onload to call the function.

I want to call the function several times inside the body. How can I do that?

Thank you!
Avatar of Barry Jones
Barry Jones
Flag of United Kingdom of Great Britain and Northern Ireland image

You will need to call either createGradientV() or createGradientH() directly.  You can do this from links, input elements etc...
<button type="button" id="some_id" onclick="createGradientV(...);">Create V Gradient</button>
 
<a href="javascript:void(0);" onclick="createGradientH(...)" title="">Create H Gradient</a>

Open in new window

Avatar of AphX
AphX

ASKER

Ooh nice!

Can I call the function without any onclick element?

I want the function to be called like this:

<?php
for(some loop){
    <script type="text/javascript" language="javascript">
      createGradientV([255, 255, 255], [255, 255, 0], 1, 40);
</script>
}
?>

Is this possible?
ASKER CERTIFIED SOLUTION
Avatar of Barry Jones
Barry Jones
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AphX

ASKER

You are the king! How would I survive without you?! :D
Gracias!