I have below code it works fine
<a href ="#" onclick="accept ("<?php echo $getservice [$i]['id']; ?>, document.frml)"> Accept </a>
In above code, I'm calling Javascript function by onclick event.
Now I want to change the event to onload. But it doesn't work.
<a href ="#" onload="accept ("<?php echo $getservice [$i]['id']; ?>, document.frml)"/>
Please help me to resolve this.
You cannot bind the onLoad
DOM event to the <a>
element, so this is no bug and only related to the JS event handler, not PHP as your title suggest. If you want to fire an onLoad
event you want to think of putting it into the <body>
-tag instead.
See a reference here: https://en.wikipedia.org/wiki/DOM_events