用鼠标左键拉一下,选中单词就会弹出小框框,显示该单词的翻译,请问这个是怎么样的原理呢?请高手解读1,2 好像是DIV层的隐藏和显示原理 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 装一个翻译软件不就好了么!如:“雅虎有道”,“IBM词典”等等。 不难,呵呵.可能实现的有两种方式:1 利用ie html自带的属性.比如说 <a herf='xxx' alt='hello'>你好</a>.2 动态产生层,监听鼠标事件,onmouseover onmouseout ,onmouseover 在事件中动态创建层或者显示隐藏的层并调整层的显示位置,并且获取翻译. onmouseout 销毁层或者隐藏层. lz指的应该是这种吧http://dict.hjenglish.com/w/php <html><head><script>var $_text = '';(function(){ document.onmousemove = function(){$_text = document.selection ? document.selection.createRange().text : window.getSelection(); } document.onmouseup = function(){if($_text!='')alert($_text)}})()</script></head><body><div>hello world</div>check this simple example out</body></html> 请教关于用户与用户组的关联问题 PHP正则表达式的问题。 全局和静态变量的引用 网络办公系统中的office软件可否用php来连接到网页上 菜鸟求教MySQL的安装问题 php调用当当网api 哪里有好的商业信息程序设计下载? [急@!]为什么我的VBB论坛不能上传了.... 请教关于文件上传大小问题(S O S)在线关注! thinkphp 日志记录没有文件生成 怎么样用PHP实现网上在线录音功能? WIN2003下搭建PHP运行环境(apache+mysql)的问题
可能实现的有两种方式:
1 利用ie html自带的属性.比如说 <a herf='xxx' alt='hello'>你好</a>.
2 动态产生层,监听鼠标事件,onmouseover onmouseout ,onmouseover 在事件中动态创建层或者显示隐藏的层并调整层的显示位置,并且获取翻译. onmouseout 销毁层或者隐藏层.
http://dict.hjenglish.com/w/php
<head>
<script>
var $_text = '';
(function(){
document.onmousemove = function(){$_text = document.selection ? document.selection.createRange().text : window.getSelection(); }
document.onmouseup = function(){if($_text!='')alert($_text)}
})()
</script>
</head>
<body>
<div>hello world</div>
check this simple example out
</body>
</html>