try:<script>
function doBar(flag){
if (flag==0){
 document.all.t1.className="nobar" ;
 document.all.t2.className="nobar" ;
 }
if (flag==1){
 document.all.t1.className="" ;
 document.all.t2.className="" ;
}
}
</script><input type="text" name="t1" class=nobar value="文本1" > 
<input type="text" name="t2" class=nobar value="文本2" >
<br>
<input type=button name=b1 value="没有边框" onclick="doBar('0');">
<input type=button name=b1 value="有边框" onclick="doBar('1');">

解决方案 »

  1.   

    请参照CSS的MEDIA的用法:// For computer screens, the font size is 12pt.
    @media screen {
       BODY {font-size:12pt;}
    }
    // When printed, the font size is 8pt.
    @media print {
       BODY {font-size:8pt;}
    }
      

  2.   

    请参照CSS的MEDIA的用法:// For computer screens, the font size is 12pt.
    @media screen {
       BODY {font-size:12pt;}
    }
    // When printed, the font size is 8pt.
    @media print {
       BODY {font-size:8pt;}
    }
      

  3.   

    net_lover:我对css不熟悉,现在又急着要,能不能给给详细代码
      

  4.   

    <style>@media print {input {border:0pt;}}</style><input type="text" value="abc"> 
    <input type="text" value="def">
      

  5.   

    qiushuiwuhen:
    那是不是这个写法只针对 input 可以,如果我要使 select\textarea
    的边框在打印时不显示,也可以使用同样 方法呢?
      

  6.   

    一样的原理<style>@media print {input,select,textarea {border:0pt;}}</style><input type="text" value="abc"> 
    <input type="text" value="def">
    <select><option>hehe</select>
    <textarea>hehe</textara> 
      

  7.   

    qiushuiwuhen(秋水无恨) 十分谢谢,不过用了这个方法,好象只能不打印select的边框,
    但旁边的一个下拉按钮无法去掉.还有办法吗?
      

  8.   

    <style>@media print{
    input,select,textarea {border:0pt;}
    .hideSel{position:absolute;clip:rect(0,80,30,0)}
    .hideSel2{position:absolute;clip:rect(0,40,30,0)}
    }</style><div class=hideSel><select><option>需手动调rect</select></div>
    <br>
    <div class=hideSel2><select><option>hehe</select></div>
      

  9.   

    或者.......
    <style>@media print{
    input,textarea {border:0pt;}
    select{qswh:expression(this.outerHTML=this.innerText)}
    }</style>
    <script>
    function window.onbeforeprint(){
    var o=document.getElementsByTagName("select");
    for(i=0;i<o.length;i++){o[i].outerHTML=o[i--].innerText}
    }
    </script>
    <select><option>需手动调rect</select>
    <select><option>hehe</select>
      

  10.   

    或者.......
    <style>@media print{
    input,textarea {border:0pt;}
    }</style>
    <script>
    function window.onbeforeprint(){
    var o=document.getElementsByTagName("select");
    for(i=0;i<o.length;i++){o[i].outerHTML=o[i--].innerText}
    }
    </script>
    <input type="text" value="abc"> 
    <select><option>hehe</select>
    <input type="text" value="def">
    <select><option>hehe</select>
    <textarea>hehe</textara>
      

  11.   

    qiushuiwuhen(秋水无恨) 大虾:
    这样做还是有些问题:
    1
    对于select or textarea 在打印预览时是取消边框的
    但当返回时,就无法恢复到select or textarea 的原样了,还是文本。
    2
    对于select中OPTION有多个值的情况,能否只显示当前被选中的那个。而不是
    全部
      

  12.   

    net_lover(孟子E章) 对于这个问题你有更好的办法吗?
      

  13.   

    目前用css控制打印是比较好的办法。
      

  14.   

    那你在body的onbeforeprint中把边框设掉!
    在onafterprint中恢复边框!