php如何鼠标移到图片链接显示缩略图? RT<a href="xxxxxxxxxx" target="_blank">zzzz</a>要求鼠标移到图片链接显示缩略图 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 要用JavaScript写个函数,当鼠标移动那里就执行该函数,用onmouseover调用函数就可以 <!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=utf-8" /><title>无标题文档</title><script type="text/javascript">window.onload = function() { var links = document.getElementById('demo').getElementsByTagName('a'); for( var i = 0; i < links.length; i ++) { links[i].onmouseover = function() { var url = this.getAttribute('thumb'); var img = document.createElement('img'); img.src = url; img.style.position = 'absolute'; img.style.top = this.offsetTop; document.getElementById('demo').appendChild(img); } links[i].onmouseout = function() { var img = document.getElementById('demo').getElementsByTagName('img')[0]; img.parentNode.removeChild(img); } }}</script></head><body><div id="demo" style="position:relative;"><a href="#" target="_blank" thumb='http://img3.cache.netease.com/www/logo/logo_png.png'>163.com</a><br /><a href="#" target="_blank" thumb='http://www.google.com.hk/intl/zh-CN/images/logo_cn.png'>Google.com</a></div></body></html> <!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=utf-8" /><title>无标题文档</title><script type="text/javascript">window.onload = function() { var links = document.getElementById('demo').getElementsByTagName('a'); for( var i = 0; i < links.length; i ++) { links[i].onmouseover = function() { var url = this.getAttribute('thumb'); var img = document.createElement('img'); img.src = url; img.setAttribute('width','50px'); img.setAttribute('height','50px'); img.style.position = 'absolute'; img.style.top = this.offsetTop; document.getElementById('demo').appendChild(img); } links[i].onmouseout = function() { var img = document.getElementById('demo').getElementsByTagName('img')[0]; img.parentNode.removeChild(img); } }}</script></head><body><div id="demo" style="position:relative;"><a href="#" target="_blank" thumb='http://img3.cache.netease.com/www/logo/logo_png.png'>163.com</a><br /><a href="#" target="_blank" thumb='http://www.google.com.hk/intl/zh-CN/images/logo_cn.png'>Google.com</a></div></body></html> 那你显示的就不叫缩略图,而是以较小的尺寸显示图片:<!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=utf-8" /><title>无标题文档</title><script type="text/javascript">window.onload = function() { var links = document.getElementById('demo').getElementsByTagName('a'); for( var i = 0; i < links.length; i ++) { links[i].onmouseover = function() { var url = this.getAttribute('thumb'); var img = document.createElement('img'); img.src = url; img.style.position = 'absolute'; img.style.top = this.offsetTop; img.style.width = '80px'; //设置宽度 //img.style.height = '50px'; //设置图片高度,高宽只设置一个时,浏览器会自动计算另一个值,实现等比例缩放 document.getElementById('demo').appendChild(img); } links[i].onmouseout = function() { var img = document.getElementById('demo').getElementsByTagName('img')[0]; img.parentNode.removeChild(img); } }}</script></head><body><div id="demo" style="position:relative;"><a href="#" target="_blank" thumb='http://img3.cache.netease.com/www/logo/logo_png.png'>163.com</a><br /><a href="#" target="_blank" thumb='http://www.google.com.hk/intl/zh-CN/images/logo_cn.png'>Google.com</a></div></body></html> 求一个兼容谷歌浏览器的加入收藏js javascript自定义类的方法问题 web中ActiveX控件键盘事件问题 javascript function中 return {fun1:fun1},return {fun1:fun1}是什么意思? jquery,这是什么用法? 有谁用过国双科技的量化代码 对js不熟悉,关于js显示时间并刷新 如何实现下拉式菜单,并可以根据权限使之变灰? 看偶做的树形菜单(右键可配置,动态加载) submit表单提交 关于js 的history.back() ext 如何让grid其中一列的combox为只读
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
var links = document.getElementById('demo').getElementsByTagName('a');
for( var i = 0; i < links.length; i ++) {
links[i].onmouseover = function() {
var url = this.getAttribute('thumb');
var img = document.createElement('img');
img.src = url;
img.style.position = 'absolute';
img.style.top = this.offsetTop;
document.getElementById('demo').appendChild(img);
}
links[i].onmouseout = function() {
var img = document.getElementById('demo').getElementsByTagName('img')[0];
img.parentNode.removeChild(img);
}
}
}
</script>
</head><body>
<div id="demo" style="position:relative;">
<a href="#" target="_blank" thumb='http://img3.cache.netease.com/www/logo/logo_png.png'>163.com</a><br />
<a href="#" target="_blank" thumb='http://www.google.com.hk/intl/zh-CN/images/logo_cn.png'>Google.com</a>
</div>
</body>
</html>
<!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=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
var links = document.getElementById('demo').getElementsByTagName('a');
for( var i = 0; i < links.length; i ++) {
links[i].onmouseover = function() {
var url = this.getAttribute('thumb');
var img = document.createElement('img');
img.src = url;
img.setAttribute('width','50px');
img.setAttribute('height','50px');
img.style.position = 'absolute';
img.style.top = this.offsetTop;
document.getElementById('demo').appendChild(img);
}
links[i].onmouseout = function() {
var img = document.getElementById('demo').getElementsByTagName('img')[0];
img.parentNode.removeChild(img);
}
}
}
</script>
</head><body>
<div id="demo" style="position:relative;">
<a href="#" target="_blank" thumb='http://img3.cache.netease.com/www/logo/logo_png.png'>163.com</a><br />
<a href="#" target="_blank" thumb='http://www.google.com.hk/intl/zh-CN/images/logo_cn.png'>Google.com</a>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
var links = document.getElementById('demo').getElementsByTagName('a');
for( var i = 0; i < links.length; i ++) {
links[i].onmouseover = function() {
var url = this.getAttribute('thumb');
var img = document.createElement('img');
img.src = url;
img.style.position = 'absolute';
img.style.top = this.offsetTop;
img.style.width = '80px'; //设置宽度
//img.style.height = '50px'; //设置图片高度,高宽只设置一个时,浏览器会自动计算另一个值,实现等比例缩放
document.getElementById('demo').appendChild(img);
}
links[i].onmouseout = function() {
var img = document.getElementById('demo').getElementsByTagName('img')[0];
img.parentNode.removeChild(img);
}
}
}
</script>
</head><body>
<div id="demo" style="position:relative;">
<a href="#" target="_blank" thumb='http://img3.cache.netease.com/www/logo/logo_png.png'>163.com</a><br />
<a href="#" target="_blank" thumb='http://www.google.com.hk/intl/zh-CN/images/logo_cn.png'>Google.com</a>
</div>
</body>
</html>