<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>简单的写了个</title>
<script type="text/javascript">
var number = 0;window.onload = function () {
var ifr = frames[0];
ifr.document.designMode = 'on';
ifr.document.body.innerHTML = '测试一下';
ifr.document.addEventListener('mouseup', function () {
document.getElementById('status').innerHTML = 'MSG:' + (number ++)
+ '<br \/>必须要addEventListener';
}, false);
};
</script>
</head>
<body>
<div style="position:absolute; width:100px; height:100px; background-color:#999999; left:100px; overflow:hidden;">
<br /><input id="wc" type="text" value="#FF0000" />
<br /><br /><input type="button" value="点我给它着色" title="点我给它着色" onclick="
var ifr = frames[0]
ifr.document.execCommand('hilitecolor', false, document.getElementById('wc').value);
ifr.focus();
" />
</div>
<iframe width="500" height="200"></iframe>
<div id="status"></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>简单的写了个</title>
<script type="text/javascript">
var number = 0;window.onload = function () {
var ifr = frames[0];
ifr.document.designMode = 'on';
ifr.document.body.innerHTML = '测试一下';
ifr.document.addEventListener('mouseup', function () {
document.getElementById('status').innerHTML = 'MSG:' + (number ++)
+ '<br \/>必须要addEventListener';
}, false);
};
</script>
</head>
<body>
<div style="position:absolute; width:100px; height:100px; background-color:#999999; left:100px; overflow:hidden;">
<br /><input id="wc" type="text" value="#FF0000" />
<br /><br /><input type="button" value="点我给它着色" title="点我给它着色" onclick="
var ifr = frames[0]
ifr.document.execCommand('hilitecolor', false, document.getElementById('wc').value);
ifr.focus();
" />
</div>
<iframe width="500" height="200"></iframe>
<div id="status"></div>
</body>
</html>
解决方案 »
- Javascript 的语句结束 是否用分号
- 如何让 点击链接的时候不触发<tr>的onclick
- JS 设置线条样式控件
- 帮我做一道算术题,又简单又不简单。
- submit后无返回是什么原因
- 不惜血本再开一200(两贴共350分)分贴--如何实现方向键控制页面的输入焦点(左方向键--焦点回退,右方向键--焦点前进)
- 《javascript高级程序设计》第二版和《html5程序设计》第二版有没有人要?免费送的
- 自己动手写一个拼图游戏
- 怎样不刷新页面,即时获得可以走动服务器时间,也就是在页面上加一个服务器端的时钟
- 没学习资料,从最蠢的问题问起:怎么加入响应事件的代码啊?
- .net c#在内容页中怎样添加动态Title?
- 如何在页面中显示javascript函数的返回值?
doc.write("点击我在IE下有事件,FF下没有")
if(IsIE)
doc.onclick = function(){alert('x');}
else
doc.addEventListener("click",function(){alert('x');},false);
}