[Javascript] To DOM or not -- calendar popup

Matt Warden mwarden at gmail.com
Wed Mar 29 13:43:26 CST 2006


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

Bill Moseley wrote:
> 2) or in the script search for the input field and then append the
> <img>  to the field's parent node list?[1]
> 
> Seems like 2 is the "correct" way to go, but seems like a bit more
> work.

It's not that bad. Something like:

if (document.getElementById && document.createElement) {
	var field = document.getElementById('whatever');
	if (field) {
		var img = document.createElement('img');
		img.src = 'whatever.foo';
		img.onclick = calPopupFunction;
		field.parentNode.appendChild(img);
	}
}


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


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

iD8DBQFEKuNerI3LObhzHRMRAgv5AJ0Vz4QjZMgtG8sFAW7NoUpJx8dZ4QCgvlCL
vbV4MibAi1GC3Ii3atT6JVE=
=kpz9
-----END PGP SIGNATURE-----



More information about the Javascript mailing list