<input type=checkbox 
onclick="alert(txt1.style.fontSize);txt1.style.color=(txt1.style.color=='#000000')?'#ff0000':'#000000';txt1.style.fontSize=(txt1.style.fontSize=='12pt')?'9pt':'12pt';">
<input type=text value="test" id=txt1 style="color:#000000;font-size:12pt;">

解决方案 »

  1.   

    在文本框中编程实现,onFocus里设置它的color ,及大小
      

  2.   

    <input type=checkbox 
    onclick="txt1.style.color=(txt1.style.color=='#000000')?'#ff0000':'#000000';txt1.style.fontSize=(txt1.style.fontSize=='12pt')?'9pt':'12pt';">
    <input type=text value="test" id=txt1 style="color:#000000;font-size:12pt;">
      

  3.   

    <input id=xx type=checkbox onselect="sw()"><input id=ss>
    <script>
    function sw(){
    if(xx.selected==true)
    document.all.ss.style.color="red";
    document.all.ss.style.fontSize="14pt";
    }
    else{
    document.all.ss.style.color="black";
    document.all.ss.style.fontSize="9pt";}
    </script>
      

  4.   

    <html>
    <body >
    <input id=pp type=text value=exam>color:<input type=checkbox value=red onclick="if(this.checked==true) pp.style.color='red'; else pp.style.color='black' ">size:<input type=checkbox vlaue=20 onclick="if(this.checked==true) pp.style.fontSize='20'; else pp.style.fontSize='14'">
    </body>
    </html>
      

  5.   

    最好写成函数
    <script language="JavaScript">
    <!--
    function chg(t,o,s,str){
    var tt=document.frm.elements[t]
    tt.style[s]=o.checked?str:''
    }
    //-->
    </script>
    <form name=frm>
    <input type="text" name="test">
    <input type="checkbox" onclick="chg('test',this,'fontSize','15pt')">
    <input type="checkbox" onclick="chg('test',this,'color','red')">
    <input type="checkbox" onclick="chg('test',this,'backgroundColor','yellow')">
    </form>
      

  6.   

    测试成功的代码:
    <html>
    <head>
    <title>Untitled Document</title>
    <script language="JavaScript">
    function ddd(ss)
    {
      alert(ss)
      if (ss=='color')
      {
      document.changestyle.text1.style.color=document.changestyle.color1.value;
      return;
      }
      if (ss=='size')
      {
        document.changestyle.text1.style.fontSize=document.changestyle.size1.value;
        return;
      }
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <form name="changestyle" method="post" action="">
      <input type="text" name="text1">
      大小  
      <select name="size1" onchange="ddd('size')">
        <option value="10px">10px</option>
        <option value="11px">11px</option>
        <option value="12px">12px</option>
        <option value="13px">13px</option>
        <option value="14px">14px</option>
      </select>
      颜色
      <select name="color1" onchange="ddd('color')">
      <option value="red">red</option>
      <option value="blue">blue</option>
      <option value="yellow">yellow</option>
    </select>
    </form>
    </body>
    </html>
      

  7.   

    http://www.csdn.net/cnshare/soft/5/5819.shtm
      

  8.   

    <html><head><title>New Page 1</title>
    </head><body><form method="POST" action="">
     
      <p><input type="text" name="t1" size="20">
      <input type="checkbox" name="C1" value="ON" onclick="if(this.checked){t1.style.color='red'} else{t1.style.color='black'}">red&nbsp;    
      <input type="checkbox" name="C2" value="ON">green</p>
    </form></body></html>
      

  9.   

    <html><head><title>New Page 1</title>
    </head><body><form method="POST" action="">
     
      <p><input type="text" name="t1" size="20">
      <input type="checkbox" name="C1" value="ON" onclick="if(this.checked){t1.style.color='red'} else{t1.style.color='black'}">red&nbsp;        
      <input type="checkbox" name="C2" value="ON" onclick="if(this.checked){t1.style.fontSize='18'} else{t1.style.fontSize='15'}">18px</p>
    </form></body></html>