glycerides
01-22-2012, 01:55 AM
hello Sir/Mam
i have a piece of code here that creates a dynamic form..
<script type='text/javascript' language='javascript'>
<!--
function createTextbox(){
var textboxtag = document.createElement("input");
textboxtag.setAttribute("name","username");
document.getElementById("form1").appendChild(textboxtag);
}
-->
</script>
<body>
<div id='div1'>
<button name='textbox' onclick='createTextbox()'>Textbox</button>
</div>
<div id='div2'>
<form id='form1' action='#' method='post'>
</form>
</div>
</body>
this code sets the "name" attribute to "username" automatically..
my problem is how to set the name attribute manually by the user after the dynamic textbox is created..
just like in visual basic where after you create a form e.g button or textfield, theres a side pane where you can change attributes like name, value, etc..
tnx for the time reading my post..sorry for my poor explanation of the problem..im new in javascript and trying to learn it all by myself..:(
i have a piece of code here that creates a dynamic form..
<script type='text/javascript' language='javascript'>
<!--
function createTextbox(){
var textboxtag = document.createElement("input");
textboxtag.setAttribute("name","username");
document.getElementById("form1").appendChild(textboxtag);
}
-->
</script>
<body>
<div id='div1'>
<button name='textbox' onclick='createTextbox()'>Textbox</button>
</div>
<div id='div2'>
<form id='form1' action='#' method='post'>
</form>
</div>
</body>
this code sets the "name" attribute to "username" automatically..
my problem is how to set the name attribute manually by the user after the dynamic textbox is created..
just like in visual basic where after you create a form e.g button or textfield, theres a side pane where you can change attributes like name, value, etc..
tnx for the time reading my post..sorry for my poor explanation of the problem..im new in javascript and trying to learn it all by myself..:(