GingerRobot Posted August 6, 2006 Share Posted August 6, 2006 Ok, i have solved my previous problem but have another so i might as well just modify this topic.why does this:parent.document.all.due.value=date;work, and not this:parent.document.getElementById('due').value=date;As i understand it, you shouldn't use all anymore, but use getElementById, and certainly Firefox gives a warning although it still functions.Any help would be much appreciated. Thanks, Ben Link to comment https://forums.phpfreaks.com/topic/16711-getelementbyid-troublessolved/ Share on other sites More sharing options...
448191 Posted August 7, 2006 Share Posted August 7, 2006 Try to stick to methods and props defined in the DOM level 2 W3C recommendation, and implement fixes for IE.[code]document.getElementById('due').nodeValue = date;[/code]Should work in at least IE6 and FF, not sure about all versions of IE5.You might have to use a little [url=http://"http://javascriptkit.com/javatutors/objdetect2.shtml"]object detection[/url].Some older versions of IE use the "document.all" model, which sucks, but is better than nothing:[code]if (!document.getElementById) { if(!document.all) { //DOM not supported :'( return; } else { //Document.all model document.all.due.value=date; }} else { //W3C DOM document.getElementById('due').nodeValue = date;}[/code] FF did partly adopt Microsoft's document.all model for older sites still using it. Link to comment https://forums.phpfreaks.com/topic/16711-getelementbyid-troublessolved/#findComment-70526 Share on other sites More sharing options...
GingerRobot Posted August 8, 2006 Author Share Posted August 8, 2006 Thanks for your help although it seems i must have made a typo when trying what i did above, as that is working fine now in both FF and IE6. Link to comment https://forums.phpfreaks.com/topic/16711-getelementbyid-troublessolved/#findComment-71202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.