jeeva Posted February 26, 2007 Share Posted February 26, 2007 hi frnds, anyone can help me? here my problem, i need to get form field dynamically.whenever user click the new link the new text field has to add with the form can i do this? if yes, how? or any open source is there for this? thanks in advance jeeva Quote Link to comment Share on other sites More sharing options...
suzzane2020 Posted February 26, 2007 Share Posted February 26, 2007 <script language="JavaScript" type="text/javascript"> function changeIt() { var i = 1; my_div.innerHTML = my_div.innerHTML +"<br> ><input type='text' name='others'+ i>" </script> place te div tags in the form where u want te field to appear. eg: <div id="my_div"></div> //call this function on a onclick event of te link Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted February 26, 2007 Share Posted February 26, 2007 <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>yoshi</title> <script type="text/javascript"> <!-- function addEvent() { var ni = document.getElementById('dadiv'); var numi = document.getElementById('theValue'); var num = (document.getElementById("theValue").value -1)+ 2; numi.value = num; var divIdName = "my"+num+"Div"; var newdiv = document.createElement('div'); newdiv.setAttribute("id",divIdName); newdiv.innerHTML = "<input type=\"text\" name=\"hello\">"; ni.appendChild(newdiv); } function removeEvent(divno) { var d = document.getElementById('dadiv'); var olddiv = document.getElementById(divno); d.removeChild(olddiv); } //--> </script> </head> <body> <input type="hidden" value="0" id="theValue" /> <p><a href="javascript:;" onclick="addEvent();">click here to add</a></p> <div id="dadiv"> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.