sjns Posted October 31, 2010 Share Posted October 31, 2010 Hi, If someone here is willing to help me I would really appreciate the function removeInput() of javascript at below not work properly, what i should do? <script language="javascript"> fields = 0; function addInput() { if (fields != 10) { var htmlText = "<input type='text' name='friends[]' value='' size='auto' maxlength='45' /><br />"; var newElement = document.createElement('div'); newElement.id = 'addfriend'; newElement.innerHTML = htmlText; var fieldsArea = document.getElementById('addfriend'); fieldsArea.appendChild(newElement); fields += 1; } else { alert("Only 10 friends allowed."); document.form.add.disabled=true; } } //field = 0; function removeInput() { //======= doesn't work =========== var div = document.getElementById('addfriend'); var lastElement = document.removeElement('div'); lastElement.id = 'addfriend'; if (lastElement > 2) div.Element(lastElement - 1); } </script> Thanks a lots Link to comment https://forums.phpfreaks.com/topic/217336-function-remove-doesnt-work-please-help/ Share on other sites More sharing options...
trq Posted October 31, 2010 Share Posted October 31, 2010 the function removeInput() of javascript at below not work properly, what i should do? I'd start by defining 'not work properly'. Link to comment https://forums.phpfreaks.com/topic/217336-function-remove-doesnt-work-please-help/#findComment-1128570 Share on other sites More sharing options...
sjns Posted November 2, 2010 Author Share Posted November 2, 2010 Thanks for your reply. i mean not work properly because the error message appear when i tested in MS. Frontpage said: Line: 24 Char:9 Error: Object doesn't support this property or method code: 0 any Idea to make this run? Link to comment https://forums.phpfreaks.com/topic/217336-function-remove-doesnt-work-please-help/#findComment-1129332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.