DateTextBox.ClientID
用这个看看
用母版页的话取id要用这个

解决方案 »

  1.   

    什么意思?不明白。
    js这么取id?
      

  2.   

    DateTextBox.ClientID
    这个是取控件在html中的id
    用了母版页的话控件id在html中会改变
    你看看html的源码就知道了
      

  3.   

    <%= DateTextBox.ClientID %>
    这样取
      

  4.   

    我知道,我的帖子做了一点处理,没想到也没逃过你的眼睛,失敬失敬。原代码是这样的:onclick="calendar(document.getElementById('_ctl0_ContentPlaceHolder1_DateTextBox'));"我是直接这样写的。
      

  5.   

    谢谢你!Article.aspx<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeFile="Article.aspx.cs" Inherits="Admin_Article" Title="上海宝山国资委新闻发布系统" ValidateRequest="false"%>
    <%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <table border="0" cellpadding="5" cellspacing="0">
            <tr>
                <td style="width: 80px">
                    新闻标题</td>
                <td style="width: 800px">
                    <asp:TextBox ID="TitleTextBox" runat="server" Width="500px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 80px">
                    选择分类</td>
                <td style="width: 800px">
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    信息动态</td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:RadioButton ID="ReportRadio" runat="server" Text="要闻报道" GroupName="CategoryGroup" Checked="True" />
                    <asp:RadioButton ID="SpeakRadio" runat="server" Text="领导讲话" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="TrendsRadio" runat="server" Text="国集资动态" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="ColumnRadio" runat="server" Text="农村经济专栏" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="ForumRadio" runat="server" Text="国资论坛" GroupName="CategoryGroup" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    政策法规</td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:RadioButton ID="StatuteRadio" runat="server" Text="法律法规" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="RulesRadio" runat="server" Text="规章制度" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="EnterpriseRadio" runat="server" Text="企业管理" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="AdministrationRadio" runat="server" Text="行政事业管理" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="EcunumyRadio" runat="server" Text="农村集体经济" GroupName="CategoryGroup" />
                    <asp:RadioButton ID="OperationRadio" runat="server" Text="综合业务" GroupName="CategoryGroup" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    下载园地</td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:RadioButton ID="DownloadRadio" runat="server" GroupName="CategoryGroup" Text="下载园地" /></td>
            </tr>
            <tr>
                <td>
                    日期</td>
                <td><asp:TextBox ID="DateTextBox" runat="server" onfocus="calendar();"></asp:TextBox>
                    <img src="Images/calendar.gif" onclick="calendar(document.getElementById('_ctl0_ContentPlaceHolder1_DateTextBox'));"/></td>
            </tr>
            <tr>
                <td colspan="2">
                    新闻图片</td>
            </tr>
            <tr>
                <td colspan="2">
                    图片描述:<asp:TextBox ID="ImageAltText" runat="server" Width="250px"></asp:TextBox>
                    图片上传<input id="NewsImageFile" type="file" runat="server"/>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    内容</td>
            </tr>
            <tr>
                <td colspan="2">
                    <FCKeditorV2:FCKeditor ID="FCKeditor" runat="server" Height="350px" ToolbarSet="SACWeb">
            </FCKeditorV2:FCKeditor>
                </td>
            </tr>
            <tr>
                <td style="width: 80px">
            </td>
            <td style="width: 800px">
            <asp:Button ID="SubmitButton" runat="server" Text=" 提交文章 " OnClick="SubmitButton_Click" /></td>
            </tr>
        </table>
        <p>
            &nbsp;
        </p>    
        <p>
            &nbsp;</p>
        <script language=javascript type="text/javascript">
            topMenuThisPage(1);
        </script>
    </asp:Content>
      

  6.   

    MasterPage.master<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="Admin_MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>上海宝山国资委新闻发布系统</title>
        <link href="../Admin/css-content.css" rel="stylesheet" type="text/css" />
        <script language="javascript" type="text/javascript" src="calendar.js"></script>
        <script language=javascript type="text/javascript">
            function topMenuThisPage(n){
    var topMenuLi=document.getElementById("Nav").getElementsByTagName("li");
    for(i=0;i<topMenuLi.length;i++){
    topMenuLi[i].className="";
    }
    topMenuLi[n-1].className="thisPage";
    }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="Header">
            <div id="Logo"></div>
            <div id="Welcome">
                <asp:Label ID="UserNameLabel" runat="server"></asp:Label></div>
            <div id="Nav">
                <ul>
                    <li><a href="Article.aspx"><span style="font-size:14px;">新闻发布</span></a></li>
                    <li><a href="ArticleList.aspx"><span style="font-size:14px;">新闻管理</span></a></li>
                    <li><a href="Security.aspx"><span style="font-size:14px;">安全设置</span></a></li>
                </ul>
            </div>
            </div>
            <div id="Body">
                <div id="SideBar"></div>    
        <div id="Content">
            <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
            </asp:contentplaceholder>
        </div>
            </div>
        
        <div id="Footer">上海宝山国资委新闻发布系统</div>
        </form>
    </body>
    </html>