RT,代码如下
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DropDownList._Default" %><%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<!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>
    <style type="text/css">
        .style1
        {
            width: 100%;
            height: 22px;
        }
        .style2
        {
            width: 100%;
        }
    </style>
    <script language="javascript" type="text/javascript" src="E:\新建文件夹\My97DatePicker\WdatePicker.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownListEvent" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListEvent_SelectedIndexChanged">
            <asp:ListItem Value="hao"></asp:ListItem>
            <asp:ListItem Value="hen hao"></asp:ListItem>
        </asp:DropDownList>
    </div>
    <table class="style1">
        <tr>
            <td>
                <asp:Label ID="LabelResult" runat="server" Text="Result"></asp:Label>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Summit" runat="server" Text="Summit" />
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <table class="style1">
        <tr>
            <td>
                <asp:DropDownList ID="DropDownListAddItem" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListAddItem_SelectedIndexChanged"
                    Width="126px">
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <table class="style1">
        <tr>
            <td>
                <asp:Chart ID="ChartShow" runat="server" Height="349px" Width="753px">
                    <Series>
                        <asp:Series Name="Series1">
                        </asp:Series>
                    </Series>
                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </ChartAreas>
                </asp:Chart>
            </td>
        </tr>
    </table>
    <table class="style2">
        <tr>
            <td align="center">
                开始时间:
            </td>
            <td>
                &nbsp;
                <asp:TextBox ID="TextBox1" runat="server" onfocus="new WdatePicker(this,'%Y-%M-%D %h:%m:%s',true)"></asp:TextBox>&nbsp;
                &nbsp;
            </td>
            <td align="center">
                结束时间:
            </td>
            <td>
                &nbsp;
                <asp:TextBox ID="TextBox2" runat="server" onfocus="new WdatePicker(this,'%Y-%M-%D %h:%m:%s',true)"></asp:TextBox>&nbsp;
                &nbsp;
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
现学现卖,html不熟悉,
里边的onfocus="new WdatePicker(this,'%Y-%M-%D %h:%m:%s',true)"></asp:TextBox>&nbsp;
一句是不是就是当绑定的TextBox获得焦点,就自动生成一个My97DatePicker控件,但我点相应的TextBox的时候,没有出现时间控件
不知道是什么原因,以上是全部html代码,麻烦看看是什么地方出问题了

解决方案 »

  1.   

    <script language="javascript" type="text/javascript" src="E:\新建文件夹\My97DatePicker\WdatePicker.js"></script>把My97DatePicker放在项目文件夹里面,然后设置src为相对路径还不明白??
    比如:项目文件为WebSite1,My97DatePicker文件夹在WebSite1里面,而你那个Default.aspx页面和My97DatePicker在同一级目录下面。就这样设置:
    <script language="javascript" type="text/javascript" src="My97DatePicker\WdatePicker.js"></script>
      

  2.   


    确定My97DatePicker文件夹和页面在同一目录?点文本框的时候有没有报js错误?
    如果有,肯定就是路径引用的有问题
      

  3.   


    onfocus="new WdatePicker(this,'%Y-%M-%D %h:%m:%s',true,'default')"
    写成这样
      

  4.   

    在html中写代码。系统会有提示的。写src的时候会弹出窗口,让你选择js文件。