网页调用统一模板在网页中javascript
function ap_click(ss)
{ var ob = document.getElementsById('<%=page_index.ClientID %>'); //报对象不支持此属性或方法 // 网页生成后 id= <input name="ctl00$pp_page$page_index" type="text" id="ctl00_pp_page_page_index" name="page_index" />
if(ob!=null)
alert(ob);
else
alert('ccc');
document.all.aspnetForm.submit();
}费劲了,怎么都取不到对象,我想js赋一个值放在一个textbox里,form提交后台接。
function ap_click(ss)
{ var ob = document.getElementsById('<%=page_index.ClientID %>'); //报对象不支持此属性或方法 // 网页生成后 id= <input name="ctl00$pp_page$page_index" type="text" id="ctl00_pp_page_page_index" name="page_index" />
if(ob!=null)
alert(ob);
else
alert('ccc');
document.all.aspnetForm.submit();
}费劲了,怎么都取不到对象,我想js赋一个值放在一个textbox里,form提交后台接。
解决方案 »
- asp.net中怎么样处理新闻内容超出页面范围
- asp.net页面乱码 怎么回事???
- 请问如果设定FORMS身份验证后默认的跳转的URL
- [性能]我在首页用了21个DataList?数据量10W,好慢啊?
- 如何把asp.net项目建立在指定的地方,如d:\ssnc,而不是缺省的C:\inetpub\www下
- 我不太明白DataTextField和DataValueField的区别??
- 初学者问个调用c++dll的问题,求助
- 怎样让我的table中格子之间的大小可以像frame格式一样用户可以在发布的页面上调整
- asp.net网站发布遇到问题
- 下面的代码有什么问题啊?
- 紧急解决
- 高手请开个价求asp.net网站生成html方案或相关资料
{
if (c!=null)
{
alert(c.value);
}
}
<input type="button" value="hello" onclick="ap_clcik(this)" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtPageIndex" runat="server" />
</div>
</form>
</body>
</html><script type="text/jscript">
var box=document.getElementById('<%=txtPageIndex.UniqueID %>');
alert(box.value);
</script>脚本应该放在最下面,或者放在TextBox生成之后。
ap_click的作用是把传过来的页数付给一个textbox,id为page_index,然后form提交,我后台接但是由于引用了模板 运行后textbox的id变了ctl00_模板content的ID_page_index
document.getElementById('textbox').value = 页数 报对象不支持此属性或方法
document.getElementsById(' <%=page_index.ClientID %>'); 也报对象不支持此属性或
document.getElementsById(' <%=page_index.UniqueID %>'); 也报对象不支持此属性或