在Js文件中写一个控件????说白了还是没有明白你的意思在JS文件中定义一函数function MyFun()
{}不需要<script></script>在页面中调用
<srcipt language="JavaScript" src="JS的文件名"></script>就可以用了

解决方案 »

  1.   

    http://blog.csdn.net/gjd111686/archive/2004/07/15/41933.aspx
      

  2.   

    Input.htm
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title></title>
    <style>
    input{behavior:url('Input.htc')}
    </style>
    </head><body>
    <input type=text value="文本">
    <input type=button value="按钮">
    </body></html>
      

  3.   

    Input.htc
    <script language=javascript>
    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>
      

  4.   

    gjd111686(数字金刚)都说完了,没啥好说得了
      

  5.   

    数字金刚,我要Input.htc写到个JS文件中这样直接写不可以把
      

  6.   

    just a try...
    js
    --------------
    function test(obj)
    {
       obj.onkeyup = function()
       {
           alert(obj.value);
       }
    }css
    --------------
    .alert
    {
        lxc:expression(test(this));
    }html
    --------------
    <input type="text" class="alert">
      

  7.   

    你说的可以用 htc 来实现,请参考 msdn :http://msdn.microsoft.com/workshop/components/htc/reference/htcref.asp?frame=true