Jump to content

function remove doesn't work, please help...


sjns

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.