html 控件使用

INPUT 文本输入框:
 
<script language="javascript">
function toSum1()
{
 document.Form1.Text1.value="ltp";
 document.Form1.Text2.style.backgroundColor="#669999";
}
 
 
function selecttext() { document.Form1.TextBox6.select(); }
 
 
</script>
 
失去焦点: onblur=" toSum1()"
 
鼠标过来进,出移开效果:οnmοuseοver="b()" οnmοuseοut="h()"  (Button也可使用)
 
有关其他事件查看:  HTMLInputTextElementEvents Dispinterface
 
 
设置html控件:
 
 
   this.Text1.Style["BORDER-TOP-STYLE"]="none";
   this.Text1.Attributes["readOnly"]="readOnly";
   text6.Attributes["onclick"]="select()";

 

我们在WEB项目中,有时候需要在用户点击某个东西的时候,一些东西不可用。如果在客户端实现。最简单的就是利用disabled 。下面罗列的其中三种方式:

依次是:不可用(disabled);用一个空白来代替这个地方(Blank);这个区域为空(None)。具体可以查看这个Blog的源文件:

dadd
ccc

这三种方式其实核心代码依次是:

obj.disabled = false;

obj.style.visibility = "hidden";

obj.style.display = "none";

我把这三种收集到一起,供以后查找使用方便。

<!--演示代码开始//-->
<SCRIPT language=javascript>
function ShowDisableObject(obj)
{
 if(obj.disabled == false)
 {
  obj.disabled = true;
 }
 else{
  obj.disabled = false;
 }
 var coll = obj.all.tags("INPUT");
 if (coll!=null)
 {
  for (var i=0; i<coll.length; i++)
  {
   coll[i].disabled = obj.disabled;
  }
 }
}
 
function ShowBlankObject(obj)
{
 if(obj.style.visibility == "hidden")
 {
  obj.style.visibility = "visible";
 }
 else
 {
  obj.style.visibility = "hidden";
 }
}
 
function ShowNoneObject(obj)
{
 if(obj.style.display == "none")
 {
  obj.style.display = "block";
 }
 else
 {
  obj.style.display = "none";
 }
}
 
</SCRIPT>

display-Possible Values

blockObject is rendered as a block element.块元素(会换行)
noneObject is not rendered.
inlineDefault. Object is rendered as an inline element sized by the dimensions of the content.内流元素(不换行)
inline-blockObject is rendered inline, but the contents of the object are rendered as a block element. Adjacent inline elements are rendered on the same line, space permitting.
list-item  IE6 and later. Object is rendered as a block element, and a list-item marker is added.
table-header-groupTable header is always displayed before all other rows and row groups, and after any top captions. The header is displayed on each page spanned by a table.
table-footer-groupTable footer is always displayed after all other rows and row groups, and before any bottom captions. The footer is displayed on each page spanned by a table.
隐藏html控件
<input type=text name=txt1 style="display:none">
document.xxx.style.display="none";
Table 使用
 
1。
<asp:table id="Table2" style="BORDER-COLLAPSE: collapse" runat="server" Width="100%" GridLines="Both" BorderWidth="1px" BorderColor="DimGray">
<asp:TableRow>
<asp:TableCell BackColor="#ddddd5" align="center" Text="单位"></asp:TableCell>
<asp:TableCell BackColor="#ddddd5" align="center" Text="上报日期"></asp:TableCell>
</asp:TableRow>
</asp:table>
 
 
设置字体:cell1.Font.Size=FontUnit.Smaller;
style="BORDER-COLLAPSE: collapse" 属性是不显示表格凸出的边框,改为平框
 
 
2。单元格鼠标移动效果
 
<tr id="test"
οnmοuseοver="javascript:this.bgColor='#FFDDAA'"
οnmοuseοut="javascript:this.bgColor='#FFFFF5'"
bgColor="#fffff5">
<td vAlign="middle" align="center" colSpan="2">指定日规则列表</td>
</tr>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值