Destramic Posted December 4, 2006 Share Posted December 4, 2006 my script seems to be working but when you click on select all the conent will dispear of some reason?can this be easily explained please?see here: http://rafb.net/paste/results/t2lvb839.htmlthanks destramic Link to comment https://forums.phpfreaks.com/topic/29438-documentwrite/ Share on other sites More sharing options...
artacus Posted December 4, 2006 Share Posted December 4, 2006 after a page has loaded, document.write() REPLACES the contents of the document. Probably not what you want to do.Try instead document.getElementById('myDiv').innerHTML = 'added stuff'; Link to comment https://forums.phpfreaks.com/topic/29438-documentwrite/#findComment-135085 Share on other sites More sharing options...
Destramic Posted December 5, 2006 Author Share Posted December 5, 2006 could get it to work..could you help please?http://rafb.net/paste/results/VIRRly58.htmlthanks destramic Link to comment https://forums.phpfreaks.com/topic/29438-documentwrite/#findComment-135613 Share on other sites More sharing options...
artacus Posted December 5, 2006 Share Posted December 5, 2006 The "this" in toggle_checkboxes(this); will reference the <A> and not the form like you want it to. But that's ok. You can just change the text of your anchor rather than replace the innerHTML of the div.You're very close though. Replace :[code]var elements = the_form.parentNode.elements;[/code]With:[code] var elements = document.getElementById('edit_remove').getElementsByTagName('INPUT');[/code] Link to comment https://forums.phpfreaks.com/topic/29438-documentwrite/#findComment-135680 Share on other sites More sharing options...
Destramic Posted December 6, 2006 Author Share Posted December 6, 2006 that hasnt made it work either...the problem is displaying this:[code]document.getElementById('toggle_checkboxes').innerHTML = "<a href=\"#\" onclick=\"toggle_checkboxes(this);\">Unselect all</a>"[/code]it wont display Unselect all Link to comment https://forums.phpfreaks.com/topic/29438-documentwrite/#findComment-136268 Share on other sites More sharing options...
artacus Posted December 6, 2006 Share Posted December 6, 2006 Not what I meant.[code]<a href=\"#\" onclick=\"toggle_checkboxes(this);\">Unselect all</a>[/code][code]function toggle_checkboxes(ancObj) { ancObj.textContent = 'Select All';}[/code] Link to comment https://forums.phpfreaks.com/topic/29438-documentwrite/#findComment-136377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.