你是IE里吗?只有IE才能这样写:document.all.xxx.innerHTML="sina.com"
解决方案 »
- easyui treegrid的json数据格式是什么样的啊,燥死我了!
- EditorGridPanel如何实现行的拖动?
- 用正则表达式,如何获取某文件(*.cs)里面的类名及命名空间
- 请教一下问题,折腾了我半天了,
- 图片上下循环滚动问题
- 请问能被javascript调用的组件如何开发? 在线等.
- 这个字数统计应该怎样做?在线等?
- 如何实现选中下拉框中某一值后自动跳转倒相应的页面?不用再点击提交按钮
- 在利用javascript读取XML文件的时候有假死的状况
- <div>如何加滚动条?
- 各位高手,我怎样设置“用openchromeless时弹出的窗口”的位置(在线等待)
- 怎样判断用户要关闭当前浏览器,不用window.onunload=func;
<body>
<div id=xxx>晕菜</div>
<table id=yyy>
<tr><td>晕菜</td></tr>
</table><button onclick="document.all.xxx.innerHTML = 'sina.com'">set sina.com</button><br><br><button onclick="document.all.yyy.rows(0).cells(0).innerHTML = 'sohu.com'">set sohu.com</button>
</body>
</html>
<script>
document.all.xxx.innerHTML="sina.com"
</script>
是正确的,而<script>
document.all.xxx.innerHTML="sina.com"
</script>
<div id=xxx>csdn.net</div>
应该是错误的,会提示没有对象的
<body>
<table id=yyy>
<tr><td id=zzz>晕菜</td></tr>
</table>
<button onclick="document.all.yyy.rows(0).cells(0).innerHTML = 'sohu.com'">set td 1</button>
<button onclick="document.all.item('zzz').innerHTML = 'lanbor.com'">set td 2</button>
</body>
</html>
<body>
<table id=yyy>
<tr><td id=zzz>晕菜</td></tr>
</table>
<button onclick="document.all.yyy.rows(0).cells(0).innerHTML = 'sohu.com'">set td 1</button>
<button onclick="document.all.item('zzz').innerHTML = 'lanbor.com'">set td 2</button>
</body>
</html>
大家看看能不能搞定呢?
----------------------------------------------------------
<html>
<body>
<div id=xxx></div>
<iframe width=100 height=100 src="b.html"></iframe>
</body>
</html>b.html
-----------------------------------------------------------
<html>
<body>
<button onclick="parent.document.all.xxx.innerHTML='sohu.com'">set0</button><br>
<button onclick="parent.document.all.xxx.innerHTML='sina.com'">set1</button>
</body>
</html>如果a,b不在一个服务器上就不行了,这叫跨域操作。
--------------------------------------------------
<html>
<body>
<div id=xxx></div>
<iframe width=100 height=100 src="b.html"></iframe>
</body>
</html>b.html
--------------------------------------------
<html>
<head>
<script>
var i=0;
function setParent()
{
parent.document.all.xxx.innerHTML = ++i;
}
setInterval("setParent()",1000);
</script>
</head>
</html>
--------------------index.htm------------------------
<HTML><HEAD>
<TITLE>在线名单</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link rel=stylesheet type="text/css" href="../../css/ecall.css">
<style>
#item {position:absolute; visibility:visible; left:0px}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
//setTimeout("location.reload()",10000);
function opensend(htm)
{
window.open(htm,'发信息','Status=no,scrollbars=no,resizable=no,width=395,height=162');
}var isNS=(document.layers);
var _all=(isNS)? '' : 'all.' ;
var _style=(isNS)? '' : '.style' ;
var _visible=(isNS)? 'show' : 'visible';
var w_x, w_y, item, okscroll=false, godown;function init(){
item=eval('document.'+_all+'item'+_style);
getwindowsize();
item.visibility=_visible;
scrollpage();
}function getwindowsize() {
w_x=(isNS)? window.innerWidth-5 : document.body.clientWidth;
w_y=(isNS)? window.innerHeight : document.body.clientHeight;
(isNS)? item.clip.width=42: item.width=42;
(isNS)? item.clip.height=20 : item.height=20;
moveitem();
}function resizeNS() {
setTimeout('document.location.reload()',400);
}function moveitem() {
if (isNS) {
item.moveTo((pageXOffset+w_x-70),(w_y+pageYOffset-50))
}else{
item.pixelLeft=document.body.scrollLeft+w_x-25;
item.pixelTop=w_y+document.body.scrollTop-230;
}
}window.onload=init;
(isNS) ? window.onresize=resizeNS : window.onresize=getwindowsize ;function scrollpage() {
status = '';
if (okscroll) {
if (godown) {
(isNS)? window.scrollBy(0,8) : window.scrollBy(0,8) ;
} else {
(isNS)? window.scrollBy(0,-8) : window.scrollBy(0,-8) ;
}
}
moveitem();
setTimeout('scrollpage()', 40);
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
-->
</script>
</HEAD><BODY marginheight="0" marginwidth="0" background="images/back.gif" leftmargin="3" topmargin="2" bgproperties="fixed">
<table id=UserList width="100%" border="0" cellspacing="0" cellpadding="5" >
</table>
<iframe id=FlashFrame frameborder=0 height=0 name=flash noresize scrolling=no src="myiframe.htm" width=0></iframe>
<div id="item"><a href="javascript:void(0)" onMouseDown="okscroll=true; godown=false; MM_swapImage('up','','images/scrollup1.gif',1)" onMouseUp="okscroll=false;MM_swapImgRestore()" style="cursor:default"><img name="up" border="0" src="images/scrollup.gif" width="18" height="18"></a>
<P> </P>
<P> </P>
<P> </P>
<P> </P>
<P> </P>
<a href="javascript:void(0)" onMouseDown="okscroll=true; godown=true;MM_swapImage('down','','images/scrolldown1.gif',1)" onMouseUp="okscroll=false;MM_swapImgRestore()" style="cursor:default"><img name="down" border="0" src="images/scrolldown.gif" width="18" height="18"></a>
</div>
</BODY>
</html>----------------myiframe.htm------------------------------<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel=stylesheet type="text/css" href="css/style.css">
<script language=javascript>
<!--
setTimeout("location.reload()",8000);
-->
</script>
</HEAD>
<BODY>
<script language=javascript>if(parent.document.all.UserList.rows.length>0){parent.document.all.UserList.deleteRow();};newRow =parent.document.all.UserList.insertRow(parent.document.all.UserList.rows.length);newRow.insertCell(0).innerHTML="<table id=ShowUserList width=100% border=0 cellspacing=0 cellpadding=1><a href=javascript:opensend('send.asp?ToUserID=470') class=as01><IMG SRC='../../images/ecall/face/face03.gif' Border=0>系统管理员</a><br><a href=javascript:opensend('send.asp?ToUserID=475') class=as01><IMG SRC='../../images/ecall/face/face03.gif' Border=0>超级管理员</a><br></table>";</script>
<script language=javascript>parent.document.all.TAB_INF.rows(0).cells(0).innerHTML='<IMG SRC=../../images/ecall/message.gif>';</script>
</BODY>
</HTML>