获得光标位置,显示div 获取光标的位置,在IE里的Range对象直接提供了.FF.不知道可能还要算下吧... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你个IE ONLY的吧...<style type="text/css">html, body { margin:0; padding:100;}</style><textarea id="wc" style="width:700px; height:400px;">好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字</textarea><div id="floor" style="position:absolute;width:60px; height:20px; background-color:#000000;"></div><script type="text/javascript">var IEShow = function (wc, floor) { return function () { if (document.selection) { var range = document.selection.createRange(); floor.style.left = range.offsetLeft + 'px'; floor.style.top = range.offsetTop + 'px'; } }};window.onload = function () { var wc = document.getElementById('wc'), floor = document.getElementById('floor'); wc.onkeyup = wc.onmouseup = IEShow(wc, floor);};</script> T_TFF,没找到...硬算的话,那很麻烦的...先飘走. div要根据光标的位置,显示在光标后面有点迷糊你是想在DIV里显示光标的位置还是根据光标确定DIV的位置 谢谢,经测试可用。但是会带来我这里div显示后别的问题。我已经用getClientRects解决。结贴 急求 正则表达式 动态给网页添加样式疑惑 清熟悉jQuery的朋友給推荐个图片预览的插件 js的setTimeout的问题 这个小游戏使用javascript写的吗 IE关闭按钮事件 最近 我研究 搜索引擎 (四) 中英文混合分词 V1.0正式发布(可下载) 菜鸟求救!!!! 想在调用模态窗口时传递参数,但是没成功,高手教我!! IE6进度条的问题。(100分) Ext2.0 表单怎么直接跳转啊 求个正则,将不处于html和js标记内的关键字这个字符串替换
<style type="text/css">
html, body {
margin:0;
padding:100;
}
</style>
<textarea id="wc" style="width:700px; height:400px;">
好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字好多好多好多好多的字
</textarea>
<div id="floor" style="position:absolute;width:60px; height:20px; background-color:#000000;"></div>
<script type="text/javascript">
var IEShow = function (wc, floor) {
return function () {
if (document.selection) {
var range = document.selection.createRange();
floor.style.left = range.offsetLeft + 'px';
floor.style.top = range.offsetTop + 'px';
}
}
};
window.onload = function () {
var wc = document.getElementById('wc'), floor = document.getElementById('floor');
wc.onkeyup = wc.onmouseup = IEShow(wc, floor);
};
</script>
FF,没找到...硬算的话,那很麻烦的...
先飘走.
有点迷糊
你是想在DIV里显示光标的位置
还是根据光标确定DIV的位置