如何建立文字栏位 [英] How to create text field
本文介绍了如何建立文字栏位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建文本字段,同时我想装饰textfield.plz为此场景发送一些示例代码.
How to create textfield,at the same time i want to decorate textfield.plz send some sample code for this scenario.
推荐答案
动态创建文本框
document.write('<input type="text" class="decorate" value="dynamic textbox" />');
应用样式或修饰带有边框和字体颜色的文本框.
Applied style or decorate textbox with border and font color.
<style type="text/css">
.decorate
{
border:solid 1px red;
color:green;
}
</style>
谢谢,
Imdadhusen
Thanks,
Imdadhusen
尝试一下,
Try this,
<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>
这篇关于如何建立文字栏位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文