[thelist] JS: createHTMLElement and onclick

Matt Warden mwarden at gmail.com
Wed Jul 5 12:08:43 CDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ben morrison wrote:
> 				case ( createHTMLElement.arguments[s] == 'class' ) :
> rtnHTMLObj.className = createHTMLElement.arguments[s+1]; break;

This looks ok. How are you calling this function when class is not set
properly?

> 				case ( createHTMLElement.arguments[s] == 'onclick' ) :
> onclick=function() {createHTMLElement.arguments[s+1]}; break;

I assume args[s+1] is a string? In that case, I believe you want this:

rtnHTMLObj.onclick = new Function(arguments[s+1]);

However, you may also want to support passing a function reference, as
you could avoid large memory use when creating many elements with the
same onclick.

- --
Matt Warden
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEq/IbrI3LObhzHRMRAuR1AKCYXz1qEHH1JqimAMUphAdXHzrTzgCfW1tw
csg4TnVBRLMuYQZ7tPQImfY=
=4Ns8
-----END PGP SIGNATURE-----



More information about the thelist mailing list