陆慧总结的东西

var txtBox1=document.getElementById("TextBox1");
      txtBox1.maxLength=10;
      txtBox1.readOnly=true;
      txtBox1.value='中国。河北。保定。曲阳。王爱辉';
      txtBox1.title='曲阳县第一中学';  //javascript设置鼠标移过去显示文本
      txtBox1.width=0;
      txtBox1.style.borderStyle='none';
      txtBox1.style.borderWidth=0;
点击button
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="bb_click()" />
<input id="Button2" type="button" value="button"  onclick="bb_click()"/>

document.getElementsByTagName('input'); //注意,TagName 就是input 看上面一句

 

<Script Language="JavaScript">   
function check(obj){   
for(i=0;i<document.all(obj).length;i++){   
if(document.all(obj)(i).checked){   
return;   
}   
}   
window.alert('一个也没有选!');   
}   
</Script>

 

 

//陆慧的代码

    function bb_click()
    { 
     var txtBox1=document.getElementById("TextBox1");
     txtBox1.value='王爱辉';
     txtBox1.title='曲阳县第一中学';  //javascript设置鼠标移过去显示文本
    // txtBox1.width=0;
    // txtBox1.style.borderStyle='none';
    // txtBox1.style.borderWidth=0;
   
     var checkbox1=document.getElementById("CheckBox1");
    // checkbox1.checked="checked";//单引号和双引号都可以
    // checkbox1.checked="";
    checkbox1.checked=true; //这样也可以
    checkbox1.checked=false;
   //txtBox1.focus();
    checkbox1.focus();
    document.all("TextBox1").value="nihao";

   
    }

posted @ 2009-05-19 23:45  Daniel_Lu  阅读(145)  评论(0编辑  收藏  举报