js中的function(){}不好使
来源:互联网 发布:坎昆离墨西哥城源码 编辑:程序博客网 时间:2024/06/10 11:04
运行问题:
求好心的的神指教。谢谢
js代码:
var small = document.querySelector('#small');
var fangdajing = document.querySelector('#fangDaJing');
var big = document.querySelector('#big');
var img = document.querySelector('img');
small.onmousemove=function(){
var left=event.clientX-50;
var top=event.clientY-50;
if(left<0){left=0;}
if(left>300){left=300;}
if(top<0){top=0;}
if(top>300){top=300;}
fangdajing.style.left=left + "px";
fangdajing.style.top=top + "px";
img.style.left=left*(-5) + 'px';
img.style.top=top*(-5) + 'px';
};
small.onmouseenter=function(){
fangdajing.style.display='block';
};
small.onmouseleave=function(){
fangdajing.style.display='none';
};
HTML代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/a.js" type="text/javascript" charset="utf-8"></script>
<title>放大镜</title>
</head>
<body>
<div id="small">
<div id="fangdajing"></div>
</div>
<div id="big">
<img src="img/1.png"/>
</div>
</body>
</html>
- js中的function(){}不好使
- 如果你 <?php ?>好使 但 <? ?> 就不好使,其实是php.ini中的一个参数问题
- JS Function中的return
- js中的function
- js中的函数function
- js中的$(function()
- JS中的 $(function(){ } 是什么意思
- js 中的function
- js中的function学习
- SQL为什么不好使
- CSDN一向不好使。
- luacom GetEnumerator 不好使?
- f5刷新不好使
- bringSubviewToFront无效、不好使
- QSS debug好使release不好使
- js中的function和this
- js中的function/this细解
- js中的function不存在重载
- 缺少jinja2
- 前端影响性能的细节
- 一个mybatis配置文件的例子
- JSP 表达式
- 剑指Offer——(41)和为S的两个数字
- js中的function(){}不好使
- XZ_iOS之UIColor的RGB数值转换方法
- JAVA 图片工具类 包含图片切割,水印
- python核心编程v2.0 第7章习题答案(下)
- poj1163
- POJ 3186 Treats for the Cows(区间dp)
- 168. Excel Sheet Column Title
- webpack 压缩图片
- Linux Bash运算符