日期:2014-05-17  浏览次数:20475 次

通过js获取不到input类型的值
为什么js里的title获取不到Title1的值  ?
 一、js部分
  function getValues() {

            // 取得HTML内容

            var html = editor.html();

            // 同步数据后可以直接取得textarea的value

            editor.sync();

            html = document.getElementById('content1').value; // 原生API
            var title = document.getElementById("Title1").value;
            var flag = CreateNews.insertNews(html,title);
            if (flag == "1") {
                alert("新闻插入成功!");
            }else{
            alert("新闻插入失败!");
            }          

        }
二、页面部分
<table id="tb1"  width="100%">
<tr align="center">
        <td align="right" width="10%">标题:</td>
        <td><input id="Title1" name="Title1" style="width:100%" type="text" runat="server" /> 
            
         </td>
</tr>

<tr  align="center"><td colspan="2" align="center">
    <%--textbox id="content1" name="content" cols="100" rows="8" style="width: 700px; height: 300px;"></textbox--%>
    <textarea id="content1" name="content" cols="100" rows="8" style="width: 700px; height: 300px;"> 

    </textarea>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">            </asp:ScriptManager>