这样?
<div class="vscrollerbar" id="mySwf">用js在此插入一个swf </div>
<script>
document.getElementById('myswf').innerHTML = '<embed src="http://image.it.com.cn/images/2008/focus.swf" quality="high" width="380" height="280" allowScriptAccess="always" type="application/x-shockwave-flash"/>';
</script>
<div class="vscrollerbar" id="mySwf">用js在此插入一个swf </div>
<script>
document.getElementById('myswf').innerHTML = '<embed src="http://image.it.com.cn/images/2008/focus.swf" quality="high" width="380" height="280" allowScriptAccess="always" type="application/x-shockwave-flash"/>';
</script>
呵呵,你这个就比较难了,你的class又不是唯一的,你如何知道是给哪个DIV加?
.vscrollerbase{width: 10px;background-color: white;}
.vscrollerbar{width: 10px;background:url();}
.hscrollerbase{height: 10px;background-color: white;}
.hscrollerbar{height: 10px;background-color: black;}
.scrollerjogbox{width: 10px;height: 10px;top: auto;left: auto;bottom: 0px;right: 0px;background-color: gray;}
.copyrightnotice{font-size: 70%;font-weight: bold;text-align: center;font-family: Arial, Helvetica, sans-serif;text-indent: 0;}
#mycustomscroll1 {width: 80%;height: 250px;overflow: auto;position: relative;background-color: #E7EADE;margin: 0.3em auto;padding: 15px;}
.percentagewrap {width: 80%;margin: 0 auto;padding: 10px;}
.fixedwidth {width: 550px;height: auto;position: relative;color: black;padding: 1px;}
jshttp://artear.vicp.net/web/test/flexcroll.js
html<div class="percentagewrap">
<div id='mycustomscroll1' class='flexcroll'>
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br /> </div>
</div>
.vscrollerbar{
event:expression(
document.getElementById('myswf').innerHTML = '<embed src="http://image.it.com.cn/images/2008/focus.swf" quality="high" width="380" height="280" allowScriptAccess="always" type="application/x-shockwave-flash"/>';
)
}
event:expression(
this.innerHTML = ' <embed src="http://image.it.com.cn/images/2008/focus.swf" quality="high" width="380" height="280" allowScriptAccess="always" type="application/x-shockwave-flash"/>';
)
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<style type="text/css">
.vscrollerbar{
event:expression(ShowFlash())
}
</style>
</head><body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vscrollerbar">123</embed>
</object></td>
</tr>
</table>
</body>
</html>
<script language="javascript">
function ShowFlash()
{
var thtml="<EMBED align=left src=http://image.it.com.cn/images/2008/focus.swf height=300 width=400 type=application/x-shockwave-flash ; quality=high wmode=transparent menu=false></EMBED>";
document.write(thtml);
}
</script>
如果不唯一的话,也不知道vscrollerbar到底在页面中是第几个jQuery
$("DIV.vscrollerbar").html("你要插入的内容")Js的你自己修改了测试下:
var _vscroll = document.body.getElementsByTagName("DIV");
for(i in _vscroll){
var obj = _vscroll[i];
if('className' == obj.class){//或者你可以多添加条件如根据是否有内容才判断
obj.innerHTML = "你要插入的内容";
break;
}
}