有一母板页MasterPage.master,网页a.aspx继承该母板页,现a.aspx中还有一iframe 。
我要提的问题是:
a.aspx页中要根据网页上的某个下拉框改变iframe中的src。<td><iframe name="Preview" id="Preview" src="http://community.csdn.net/" width="99%" height="300" marginwidth="20px" marginheight="20px" border="0" frameborder="0" scrolling="both"></iframe></td>现在的问题是:在前台js里倒是可以访问得到iframe,改变它的src并reload,但无效;
后台cs代码里通过string mScript = "<script>alert(1);alert(document.all.Preview);</script>";
Response.Write(mScript);提示 document.all.Preview 为 “undefine”。
请问大家知道原因么,或有什么好的解决方法(改变iframe的src......)?
=======================
代码:
前台---
function RefreshExample(){
var control = document.getElementById("<%=hfExampleSou.ClientID%>");//定义了一个hiddenfield,用于后台换地址
if (control.value != ""){
{
document.all.Preview.src = control.value;
document.all.Preview.location.reload();
}
return true;
}
后台----
if (hfExampleSou.Value.Equals("http://community.csdn.net/"))
hfExampleSou.Value = "http://club.cat898.com/newbbs/list.asp?boardid=15";//
hfExampleSou.Value = "http://community.csdn.net/";=====================
在iframe中只显示http://community.csdn.net/
我要提的问题是:
a.aspx页中要根据网页上的某个下拉框改变iframe中的src。<td><iframe name="Preview" id="Preview" src="http://community.csdn.net/" width="99%" height="300" marginwidth="20px" marginheight="20px" border="0" frameborder="0" scrolling="both"></iframe></td>现在的问题是:在前台js里倒是可以访问得到iframe,改变它的src并reload,但无效;
后台cs代码里通过string mScript = "<script>alert(1);alert(document.all.Preview);</script>";
Response.Write(mScript);提示 document.all.Preview 为 “undefine”。
请问大家知道原因么,或有什么好的解决方法(改变iframe的src......)?
=======================
代码:
前台---
function RefreshExample(){
var control = document.getElementById("<%=hfExampleSou.ClientID%>");//定义了一个hiddenfield,用于后台换地址
if (control.value != ""){
{
document.all.Preview.src = control.value;
document.all.Preview.location.reload();
}
return true;
}
后台----
if (hfExampleSou.Value.Equals("http://community.csdn.net/"))
hfExampleSou.Value = "http://club.cat898.com/newbbs/list.asp?boardid=15";//
hfExampleSou.Value = "http://community.csdn.net/";=====================
在iframe中只显示http://community.csdn.net/
解决方案 »
- 【急】=====iis 配置问题=====
- cookie初始化
- 网站发布问题
- sql server集成验证的配置文件怎么写的.
- VS2005.NET交流群,欢迎加入!大家一块学习!
- 大家发点图表OWC的实例
- 我是初学者,请问把数据已经放到DataSet中之后,怎么再把这些数据读出来呀?比如象Asp中建立一个游标,之类的,怎么整呀?
- .net找不到页面跳转问题
- javascrip + xsl + xml客户端占用大内存,请孟子与思归等高手帮忙
- 在dropdownlist中怎样显示当前的日期
- 如何进行组件式开发啊?比如做好一个功能或者模块后怎么让以后开发的软件直接使用
- 把xmldocment 对象转换成 string
if (Session["UserID"] != null)
{
Iframe1.Attributes.Add("src", "landing.aspx");
}
else
{
Iframe1.Attributes.Add("src", "Default2.aspx");
}
另外iframe这样使用
<iframe id="Iframe1" runat="server" frameborder="0" scrolling="no" style="width: 180px; height: 140px">
</iframe>
在iframe中只显示http://community.csdn.net/ 这样的东西是使用的url混淆器,和iframe无关系