<%@ Page Title="" Language="C#" MasterPageFile="~/ancestors.Master" AutoEventWireup="true" CodeBehind="notice.aspx.cs" Inherits="loginpage.gly.notice" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
<div runat="server" >
    
    <script language="javascript">
        //设置编辑区域
        function document.onreadystatechange() {
            txtArea.document.designMode = "On";
        }
        //设置文字颜色
        function txtColor() {
            txtArea.document.execCommand("FontColor")
        }
        //设置文字居左
        function txtLeft() {
            txtArea.document.execCommand("justifyLeft");
        }
        //设置文字居中
        function txtCenter() {
            txtArea.document.execCommand("justifyCenter");
        }
        //设置文字居右
        function txtRight() {
            txtArea.document.execCommand("justifyRight");
        }
        //设置文字为粗体
        function txtbold() {
            txtArea.document.execCommand("Bold");
        }
        //设置文字为斜体
        function txtItalic() {
            txtArea.document.execCommand("Italic");
        }
        //设置文字字号                
        function txtFontName() {
            var txtSize = document.getElementById("Select1").value;
            txtArea.document.execCommand("fontsize", "", txtSize)
        }
        //设置文字下划线
        function txtUnderline() {
            txtArea.document.execCommand("Underline");
        }
        //将文本保存到隐藏域中
        function saveTxt() {
            var s = txtArea.document.body.innerHTML;
            document.getElementById("hiddenText").value = s
        }
    </script>
</div>    <div runat="server">
    <div>
        <div style="text-align: center">
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
                <tr>
                    <td style="height: 7px;" colspan="2">
                        <table border="0" cellpadding="0" cellspacing="0" 
                            style="width: 84%; height: 100%; text-align: center;">                                                    <tr>
                                <td style="width: 100%; height: 24px; ">
                                颜色<select onchange="txtColor();" id="Select2">
                                <option selected="selected" value="black">黑色</option>
                                <option value="red">红色</option>
                                <option value="blue">蓝色</option>
                                </select>
                                    字号<select onchange="txtFontName();"  id="Select1">
                                        <option  selected="selected" value="3">3</option>
                                        <option value="5">5</option>
                                        <option value="8">8</option>
                                    </select>
                                
                                
                                    <input id="btnBold" type="button" value="粗体" onclick="txtbold();" />                          
                                <input id="btnItalic" type="button" value="斜体" onclick="txtItalic();" />                               
                                <input id="btnUnder" type="button" value="下划线" onclick="txtUnderline();" />
                                <input id="btnLeft" type="button" value="左对齐" onclick="txtLeft();" />
                                <input id="btnCenter" type="button" value="居中" onclick="txtCenter();" />                             
                                <input id="btnRight" type="button" value="右对齐" onclick="txtRight();" />
                                </td>
                            </tr>
                        </table>
                        &nbsp; &nbsp; &nbsp;
                </tr>
                <tr>
                    <td  colspan="2" valign="top" style="height: 341px">
            
                        <iframe  id="txtArea" name="txtArea"    marginwidth="1" marginheight="1" allowtransparency="false"  border="0" frameborder="0" style="height: 337px; border-right: #000033 1px solid; border-top: #000033 1px solid; border-left: #000033 1px solid; border-bottom: #000033 1px solid;  " width="98%">
                           
                        </iframe>
     
                    </td>
                </tr>
            </table>
        </div>
    
    </div>    
    <input id="hiddenText" name="hiddenText" type="hidden" runat="server"  width="100%"/>
        <asp:Button ID="btnSubmit" runat="server"   Text="提交" OnClick="btnSubmit_Click1" /><br />
    
    </div>
</asp:Content>为什么其他的成功 就字体颜色不行呢???