HTC入门示例(二)

来源:互联网 发布:零基础如何自学程序员 编辑:程序博客网 时间:2024/05/07 16:08

<!--*****************input.htc******************-->

<script>
switch(type)
{
  case 'text':
  case 'password':  //文本输入框和密码输入框的样式
    style.border="1px solid #000000";
    style.backgroundColor="#FFFFFF";
    style.height="18px";
    style.font="normal 12px 宋体";
    style.color="#000000";
    break;
  case 'submit':
  case 'reset':
  case 'button':  //按钮类的样式(不包括图片按钮)
    style.border="1px solid #000000";
    style.backgroundColor="#CCCCCC";
    style.height="18px";
    style.font="normal 12px 宋体";
    style.color="#000000";
    break;
  default:  //对于象单选框多选框等上面没有出现过的元素,我们使用默认样式。
    ;
}
</script>

<!--*******************Demo2.html***************-->

注意:首先你得找一张名为“button.gif”的图片。

这个示例更多的表现了HTC对样式的支持,给人以新的感觉,HTC文件也可以这样学。没有对象,没有事件,没有方法。

小雨在线 www.smallrain.net

 

<head>
<title>用HTC统一定制表单样式实例</title>
<style type=text/css>
body  { font:normal 14px 宋体; }
input  { behavior:url('input.htc'); }
</style>
</head>

<body>
<form>
  文本框:  <input type=text><br><br>
  密码输入框:<input type=password><br><br>
  文件选择框:<input type=file><br><br>
  单选框:  <input type=checkbox><br><br>
  多选框:  <input type=radio><br><br>
  提交按钮: <input type=submit value=提交><br><br>
  重置按钮: <input type=reset value=重置><br><br>
  普通按钮: <input type=button value=返回><br><br>
  图片铵钮: <input type=image src=button.gif>
</form>
</body>

原创粉丝点击