[Javascript] To DOM or not -- calendar popup

Steve Clay sclay at ufl.edu
Wed Mar 29 13:42:28 CST 2006


Wednesday, March 29, 2006, 1:58:48 PM, 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]

var myInput = document.getElementById('myInput');
var myImg = document.createElement('img');

if (myInput.nextSibling) {
    myInput.parentNode.insertBefore(myImg, myInput.nextSibling);
} else {
    myInput.parentNode.appendChild(myImg);
}

If you use an anchor (around the img) this could be keyboard accessible (if
the calendar widget is).

Steve
-- 
http://mrclay.org/




More information about the Javascript mailing list