Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create textfield,at the same time i want to decorate textfield.plz send some sample code for this scenario.
Posted
Comments
koolprasad2003 23-Dec-11 4:00am    
Not clear. please elaborate
DeepthiTanguturi 23-Dec-11 4:01am    
After create txtfield,i want to apply stylesheets for that textfield.
DeepthiTanguturi 23-Dec-11 4:11am    
How to do that one.
Balakrishnan Dhinakaran 23-Dec-11 4:18am    
hi... do you want to create a text field on runtime?
DeepthiTanguturi 23-Dec-11 4:19am    
yes,at the same time,i want to decorate that textfield.

Dynamic creation of textbox
JavaScript
document.write('<input type="text" class="decorate" value="dynamic textbox" />');


Applied style or decorate textbox with border and font color.
CSS
<style type="text/css">
.decorate
{
   border:solid 1px red;
   color:green;
}
</style>


Thanks,
Imdadhusen
 
Share this answer
 
Comments
DeepthiTanguturi 23-Dec-11 8:07am    
its creating correctly,but it creates after that submit button,i want to display before the submit butoon.what can i do for that one?
RaviRanjanKr 23-Dec-11 15:12pm    
5+
Try this,

HTML
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Test Page</title>
    <style type="text/css">
        .clstext
        {
        color:red;
        border:solid 2px red;
        }
    </style>
    <script type="text/javascript">
      
        function addText()
        {
        var div1=document.getElementById("div2");
        div1.innerHTML="<input type='text' id='txt1'/>";
        document.getElementById("txt1").className="clstext";
        }
    </script>
   

</head>
<body  onload="addText();" >
    <form id="form1" runat="server">
   
               <br />
       
        <div id="div2"></div>
 
    </form>
</body>
</html>
 
Share this answer
 
v4
Comments
DeepthiTanguturi 23-Dec-11 4:43am    
first solution is not working.
Sunasara Imdadhusen 23-Dec-11 7:26am    
what is an error?
Shobana16 23-Dec-11 4:54am    
What error did u get?
Sunasara Imdadhusen 23-Dec-11 7:25am    
Please do us know, if you are still facing an error.
Sunasara Imdadhusen 23-Dec-11 7:25am    
Good solution!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900