SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Dynamic Form

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Form

    I have created a dynamic form. I am having 1 last issue. I have a JavaScript that will populate text boxes onclick. When I try to include the event in the form it doesnt want to work.

    Here is the code that adds the checkbox:

    Code JavaScript:
    var check=document.createElement('input');
    check.type='checkbox';
    check.name='copy2';
    check.value='checkbox';
    check.onclick='SameAddress(this.form)';

    It adds the checkbox but seems to want to leave out the onclick:
    Code HTML4Strict:
    <input value="checkbox" name="copy2" type="checkbox">

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2007
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are calling the event handler in your code. Should it be
    Code:
    check.onclick = SameAddress;
    ?
    Then in SameAddress, use this.form to reference the form.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •