如何实现框架与子页url不同时的框架页与子页的标题同步 http://community.csdn.net/Expert/topic/4811/4811906.xml?temp=.2100336 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不报错,可是没有效果,这是为什么<html xmlns="http://www.w3.org/1999/xhtml" ><script language="C#" runat=server> public string ipsession; private void Page_load(object sender,EventArgs e) { string yurl=string.Empty; if (Application["ipsession1"] == null) Response.Redirect("http://***/error.aspx"); if (Request["url"] != null) { yurl = Request["url"].ToString(); ipsession = Application["ipsession1"].ToString(); ipsession =ipsession + yurl; } else { ipsession = Application["ipsession1"].ToString(); } }</script><script type="text/jscript">/// 更新标题function main_onreadystatechange(){var main = document.getElementById( "main" );if( main.readyState == "complete" ){// 这里不能是以下语句//document.title = main.document.title;setTimeout( "document.title = main.document.title", 0 );}}function document_onreadystatechange(){if( document.readyState == "complete" ){// 取消该事件document.onreadystatechange = function(){};// 这里不能使用 inline 的方式定义var main = document.getElementById( "main" );main.onreadystatechange = main_onreadystatechange;}}document.onreadystatechange = document_onreadystatechange;</script><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">!--body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; }--></style></head><frameset rows="*,0" frameborder="NO" border="0" framespacing="0"><frame id="main" src=http://<%=ipsession%> name="mainFrame" scrolling="YES" style="overflow-y:hidden;overflow:auto;" noresize><frame src="#" name="bottomFrame" scrolling="NO" noresize></frameset><noframes><body></body></noframes></html> 在document_onreadystatechange里,将下面这句添加到main.onreadystatechange = main_onreadystatechange;后面setTimeout( "document.title = main.document.title", 0 ); 这样吗,还是没有效果出来!!!!<script language=javascript type="text/jscript">/// 更新标题function main_onreadystatechange(){var main = document.getElementById( "main" );if( main.readyState == "complete" ){// 这里不能是以下语句//document.title = main.document.title;setTimeout( "document.title = main.document.title", 0 );}}function document_onreadystatechange(){if( document.readyState == "complete" ){// 取消该事件document.onreadystatechange = function(){};// 这里不能使用 inline 的方式定义var main = document.getElementById( "main" );main.onreadystatechange = main_onreadystatechange;setTimeout( "document.title = main.document.title", 0 );}}document.onreadystatechange = document_onreadystatechange;</script> 行:1字符1错误:拒绝访问代码:0url:htp://www.infoing.com 跨域是没权限的,你的frame引用的页面必须跟主页面是同一个域名下的网站,否则不行。 不跨域直接用在子页用parent top 等可以访问的!还是谢谢你了,我再想想别的办法! 其实我的代码已经改过了,你看见的是我之前的写法,最近的写法是这样的:/// 更新标题function title_update(){ try { var main = document.getElementById( "main" ); // 这里不能是以下语句// document.title = main.document.title; setTimeout( "document.title = main.document.title", 0 ); }catch(e){}}function window_onload(){ // 取消该事件 window.detachEvent("onload",window_onload); Apq_Init(); var main = document.getElementById( "main" ); main.attachEvent("onload",title_update); // 打开起始页面 main.src = Apq$Config.Home;}window.attachEvent("onload",window_onload);==========我改用onload事件来处理了,原因是之前不了解onload与onreadystatechange的区别。现在虽然也不是非常清晰,但上面这种写法和之前那种写法相比,与我的本意更接近些。 嗯!我在现在在想在子页加iframe,url加title参数,应该可以访问框架,不过有个问题这个太复杂了,而且要考虑面页是否载入完成,有没有传参数给.js文件档的, 有千分位的js相加 要实现层在层中的拖动,求教,急、急、急、急、 脚本不兼容问题 菜鸟请求帮助 谢谢大侠 JSF表头固定问题 jQuery制作横向Accordion样式的导航菜单 jquery的contextMenu插件如何响应右键事件的,有人知道吗? javascript能控制radio的项吗? 正则(JS)re=new RegExp("^\d*$");与re=/^\d*$/;之间区别? 如何控制textarea的滚动条 confirm实现确认和取消功能,可是要是我需要确认\忽略和取消三个按扭功能,应该怎么实现?谢谢 怎样用JS生成这样的XML文档????
<script language="C#" runat=server>
public string ipsession;
private void Page_load(object sender,EventArgs e)
{
string yurl=string.Empty;
if (Application["ipsession1"] == null) Response.Redirect("http://***/error.aspx");
if (Request["url"] != null)
{
yurl = Request["url"].ToString();
ipsession = Application["ipsession1"].ToString();
ipsession =ipsession + yurl;
}
else
{
ipsession = Application["ipsession1"].ToString();
}
}
</script>
<script type="text/jscript">
/// 更新标题
function main_onreadystatechange()
{
var main = document.getElementById( "main" );
if( main.readyState == "complete" )
{
// 这里不能是以下语句
//document.title = main.document.title;
setTimeout( "document.title = main.document.title", 0 );
}
}function document_onreadystatechange()
{
if( document.readyState == "complete" )
{
// 取消该事件
document.onreadystatechange = function(){};// 这里不能使用 inline 的方式定义
var main = document.getElementById( "main" );
main.onreadystatechange = main_onreadystatechange;}
}document.onreadystatechange = document_onreadystatechange;
</script>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<frameset rows="*,0" frameborder="NO" border="0" framespacing="0">
<frame id="main" src=http://<%=ipsession%> name="mainFrame" scrolling="YES" style="overflow-y:hidden;overflow:auto;" noresize>
<frame src="#" name="bottomFrame" scrolling="NO" noresize>
</frameset>
<noframes><body>
</body></noframes>
</html>
main.onreadystatechange = main_onreadystatechange;后面
setTimeout( "document.title = main.document.title", 0 );
<script language=javascript type="text/jscript">
/// 更新标题
function main_onreadystatechange()
{
var main = document.getElementById( "main" );
if( main.readyState == "complete" )
{
// 这里不能是以下语句
//document.title = main.document.title;
setTimeout( "document.title = main.document.title", 0 );
}
}function document_onreadystatechange()
{
if( document.readyState == "complete" )
{
// 取消该事件
document.onreadystatechange = function(){};// 这里不能使用 inline 的方式定义
var main = document.getElementById( "main" );
main.onreadystatechange = main_onreadystatechange;
setTimeout( "document.title = main.document.title", 0 );
}
}document.onreadystatechange = document_onreadystatechange;
</script>
字符1
错误:拒绝访问
代码:0
url:htp://www.infoing.com
/// 更新标题
function title_update()
{
try
{
var main = document.getElementById( "main" );
// 这里不能是以下语句
// document.title = main.document.title;
setTimeout( "document.title = main.document.title", 0 );
}catch(e){}
}function window_onload()
{
// 取消该事件
window.detachEvent("onload",window_onload);
Apq_Init();
var main = document.getElementById( "main" );
main.attachEvent("onload",title_update);
// 打开起始页面
main.src = Apq$Config.Home;
}window.attachEvent("onload",window_onload);==========
我改用onload事件来处理了,原因是之前不了解onload与onreadystatechange的区别。
现在虽然也不是非常清晰,但上面这种写法和之前那种写法相比,与我的本意更接近些。
不过有个问题这个太复杂了,而且要考虑面页是否载入完成,
有没有传参数给.js文件档的,