Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Howto Include JavaScript to CGI.pm Script

by ph0enix (Friar)
on Aug 28, 2007 at 14:29 UTC ( #635621=note: print w/replies, xml ) Need Help??


in reply to Howto Include JavaScript to CGI.pm Script

It is now working fine for me. I suggest to add onLoad JavaScript handler which will finish checkbox initialization after page load. Example untested code:
<script type="text/javascript">//<![CDATA[ function init() { twofastest = document.getElementById('twofastest'); if ( twofastest ) { if ( twofastest.checked ) { twofastestClick(); } else { checkBoxClick(); } } } window.onload = init; //]]></script>

Replies are listed 'Best First'.
Re^2: Howto Include JavaScript to CGI.pm Script
by Anonymous Monk on Jun 15, 2009 at 11:40 UTC
    Hi, Do the line code: " twofastest = document.getElementById('twofastest'); if ( twofastest )" will retrieve the elementid "twofastest" while window load the page ? Because in my code after i add condition "if", it works. Before it always throw eror element id is null because it was calling on load page
      Jesus please let me give you some advice to avoid all future bugs of this nature, that whole object oriented style of writing HTML code makes me cry just write the actual code out and you will see that every single unique checkbox has an onClick() that you can add to it, javascript and HTML mesh like candy, javascript and OOP style generated HTML mesh like hotdogs and cold rice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://635621]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2023-05-31 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?