Hi guys,

 

I am trying out on how to dynamically add a struts HTML tag to a HTML page
by using javascript. I manage to get it running with normal HTML but I am
having some difficulties in using struts.

 

Below are my code in HTML (it spawn a new textbox for me):

 

function addContact(){

    var table = document.getElementById('contacts');

 

    var tr  = document.createElement('TR');

    var td  = document.createElement('TD');

    var inp = document.createElement('input');

    inp.setAttribute('name', 'inp_name');

 

    table.appendChild(tr);

    tr.appendChild(td);

    td.appendChild(inp);

}

 

 

But when I try to do the following using struts tag, it doesn't work(it
doesn't spawn a new textbox for me).

function addContact(){

    var table = document.getElementById('contacts');

 

    var tr  = document.createElement('TR');

    var td  = document.createElement('TD');

    var inp = document.createElement('html:text');

    inp.setAttribute('property', 'inp_name');

 

    table.appendChild(tr);

    tr.appendChild(td);

    td.appendChild(inp);

}

 

Anyone who had done this or have any idea on how to get around this? Thanks
in advance for the help.

 

Cheers,

Simon.

Reply via email to