导航:首页 > 万维百科 > 网页设计鼠标特效免费js

网页设计鼠标特效免费js

发布时间:2020-09-26 09:49:56

1、网页制作图片特效,鼠标放上去图片出现内发光效果。希望是js特效。不要flash。谢谢

<input type="image" src="images/1.gif" onmousemove="this.src='images/2.gif'" onmouseout="this.src='images/1.gif'" />

2、JS鼠标滑动特效和HTML的a:hover之类的 那个好些

纠正LZ
1.a:什么的 叫css 超链接伪类
2.a:visiter后面是D,指访问过的。
解释:
a:link超链接未被访问(默认)状态,
a:hover鼠标滑过超链接的状态
a:visited已访问过的链接的样式(默认是紫色)

回答问题
从代码来说,css要简单点;
毕竟css是现成的代码,做起来要省力许多,而且看起来方便,便于维护。

js代码一是多,复杂,if elseif 的太多了乱 不容易恢复 不好维护。

建议LZ再重温下css伪类的知识。

ps.在有些时候,css的代码也可能会变得复杂js反而会简单,请根据实际情况来定。

3、求代码 html css 以及 js 效果 如图 关于鼠标点击

样式可以根据实际情况布局

外部引入的js可在网上下载



<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script language="javascript" type="text/javascript" src="script/Marquee.js"></script>
</head>

<body>
<div class="imgBox">
    <div class="div_left fl"><a href="javascript:void(0);" id="goL"><img src="image/prev.jpg" /></a></div>
    <div class="div_center fl" id="marquee1">
        <ul>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
            <li><a href="#"><img src="image/img_03.jpg" /></a></li>
        </ul>
    </div>
    <div class="div_right fr"><a href="javascript:void(0);" id="goR"><img src="image/next.jpg" /></a></div>
    <span class="clear_f"></span>
</div>
<script>
$(function(){
    $('#marquee1').kxbdSuperMarquee({
        distance:227,
        time:3,
        btnGo:{left:'#goL',right:'#goR'},
        direction:'left'
    });    
});
</script>
</body>
</html>

4、在html中怎么用js实现鼠标指向图片时图片放大的效果?(具体实现)

分别写一个onmouseover和onmouseout事件。然后在事件里面加一个function,分别写想要放大的尺寸和缩小或复原的尺寸。

具体代码实现如下:

<img id="img" onmouseover="bigger()" onmouseout="smaller()" src="你的图片路径" style="width:100px;height:100px;" />

<script type="text/javascript"> 

var img = document.getElementById('img'); 

function bigger(){
 img.style.width = '400px';
 img.style.height = '400px';

function smaller(){
 img.style.width = '100px';
 img.style.height = '100px';
}

</script>

(4)网页设计鼠标特效免费js扩展资料:

HTML 4.0 的新特性之一是有能力使 HTML 事件触发浏览器中的动作(action),比如当用户点击某个 HTML 元素时启动一段 JavaScript。下面是一个属性列表,这些属性可插入 HTML 标签来定义事件动作。

参考资料:

JavaScript官方API接口-GlobalEventHandlers.onmouseover

JavaScript官方API接口-GlobalEventHandlers.onmouseout

W3cSchool-JavaScript 事件参考手册

5、网页中鼠标事件onmouseover可以用JS代码实现吗?

<script for="控件ID" event="onmouseover">
或者

控件.onmouseover=函数

6、javascript特效问题 页面上有许多点一直跟随着鼠标指针的移动。如何实现这个这个效果.

||新建html复制黏贴运行即可

<html>
<head>
<title>鼠标跟随效果</title>
<style type="text/css">
html {
overflow: hidden;
}
body {
position: absolute;
height: 100%;
width: 100%;
margin:0;
padding:0;
}
#screen {
background:#000;
position: absolute;
width: 100%;
height: 100%;
}
#screen span {
background: #fff;
font-size: 0;
overflow: hidden;
width: 2px;
height: 2px;
}
</style>
<script type="text/javascript">
var Follow = function () {
var $ = function (i) {return document.getElementById(i)},
addEvent = function (o, e, f) {o.addEventListener ? o.addEventListener(e, f, false) : o.attachEvent('on'+e, function(){f.call(o)})},
OBJ = [], sp, rs, N = 0, m;
var init = function (id, config) {
this.config = config || {};
this.obj = $(id);
sp = this.config.speed || 4;
rs = this.config.animR || 1;
m = {x: $(id).offsetWidth * .5, y: $(id).offsetHeight * .5};
this.setXY();
this.start();
}
init.prototype = {
setXY : function () {
var _this = this;
addEvent(this.obj, 'mousemove', function (e) {
e = e || window.event;
m.x = e.clientX;
m.y = e.clientY;
})
},
start : function () {
var k = 180 / Math.PI, OO, o, _this = this, fn = this.config.fn;
OBJ[N++] = OO = new CObj(null, 0, 0);
for(var i=0;i<360;i+=20){
var O = OO;
for(var j=10; j<35; j+=1){
var x = fn(i, j).x,
y = fn(i, j).y;
OBJ[N++] = o = new CObj(O , x, y);
O = o;
}
}
setInterval(function() {
for (var i = 0; i < N; i++) OBJ[i].run();
}, 16);
}
}
var CObj = function (p, cx, cy) {
var obj = document.createElement("span");
this.css = obj.style;
this.css.position = "absolute";
this.css.left = "-1000px";
this.css.zIndex = 1000 - N;
document.getElementById("screen").appendChild(obj);
this.ddx = 0;
this.ddy = 0;
this.PX = 0;
this.PY = 0;
this.x = 0;
this.y = 0;
this.x0 = 0;
this.y0 = 0;
this.cx = cx;
this.cy = cy;
this.parent = p;
}
CObj.prototype.run = function () {
if (!this.parent) {
this.x0 = m.x;
this.y0 = m.y;
} else {
this.x0 = this.parent.x;
this.y0 = this.parent.y;
}
this.x = this.PX += (this.ddx += ((this.x0 - this.PX - this.ddx) + this.cx) / rs) / sp;
this.y = this.PY += (this.ddy += ((this.y0 - this.PY - this.ddy) + this.cy) / rs) / sp;
this.css.left = Math.round(this.x) + 'px';
this.css.top = Math.round(this.y) + 'px';
}
return init;
}();
</script></head>
<body>
<div id="screen"></div>
<script type="text/javascript">
new Follow('screen', {speed: 4,
animR : 2,
fn : function (i, j) {
return {
x : j/4*Math.cos(i),
y : j/4*Math.sin(i)
}
}})
</script></body>
</html>

7、js图片鼠标经过出现文字的特效html求教

如果是纯色的方块,你直接用css就能实现,如果不是的话,就用js吧,css的话,你先把字体颜色设置成和方块背景一样的,然后写一个:hover的属性,就是鼠标经过时的属性,这时候你把背景变暗,然后文字颜色改变一下就好。js的话,写一个mouseover的事件,先让文字处于display:none;的状态,经过时,变成display:block;这样。

8、求代码:用js写一个网页,让鼠标放入左右箭头上时,中间图片左右滚动。。。。谢谢。。。

去了解下鼠标事件,mouseenter和mouseleave

9、js鼠标点击效果是如何实现的?

|脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var ver = navigator.appVersion;
var dom = document.getElementById ? 1 : 0;
var ie5 = (ver.indexOf("MSIE 5") > -1 && dom) ? 1 : 0;
var n = (document.layers);
var ie = (document.all);

var sparksAflyin = 0;
var totalSparks = 0;
var sparksOn = 1;
function initMouseEvents() {
document.onmousedown = mouseDown;
if (n) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
}
function mouseDown(e) {
if (sparksOn) {
var mousex = (n) ? e.pageX : event.x+document.body.scrollLeft;
var mousey = (n) ? e.pageY : event.y+document.body.scrollTop;
if (!sparksAflyin) {
for (var k = 0; k <= 9; k++)
eval('SHOW("sDiv'+k+'")');
sparksAflyin = 1;
totalSparks = 0;
for(i = 0;i <= 9; i++)
eval('moveTo('+i+',0,'+mousex+','+mousey+')');
}
}
}
function moveTo(i,j, mousex, mousey){
if (j < eval('anim_'+i+'_x.length') ){
var tempx = eval('anim_'+i+'_x[j]+mousex');
var tempy = eval('anim_'+i+'_y[j]+mousey');
if (ie) {
if(tempy+30 > (document.body.offsetHeight+document.body.scrollTop))
tempy = document.body.offsetHeight+document.body.scrollTop-30;
if(tempx+30 > (document.body.offsetWidth+document.body.scrollLeft))
tempx = document.body.offsetWidth+document.body.scrollLeft-30;
eval('document.all.sDiv'+i+'.style.left = tempx;');
eval('document.all.sDiv'+i+'.style.top = tempy;');
}
if (n) {
eval('document.layers.sDiv'+i+'.left = tempx;');
eval('document.layers.sDiv'+i+'.top = tempy;');
}
j++;
// timeout: 50 = fireworks speed, larger number = slower speed
setTimeout("moveTo("+i+","+j+","+mousex+","+mousey+")",50)
}
else {
eval('HIDE("sDiv'+i+'")');
totalSparks++;
}
if (totalSparks == 10) {
sparksAflyin = 0;
totalSparks = 0;
}
}
function SHOW(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "visible";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "visible";');
}
function HIDE(divName){
if (document.all)
eval('document.all.'+divName+'.style.visibility = "hidden";');
else if (document.layers)
eval('document.layers["'+divName+'"].visibility = "hide";');
}
anim_0_x=new Array(20,20,10,0,0,0,0,0,0,0,0,0);
anim_0_y=new Array(-20,-40,-60,-80,-60,-40,-20,0,20,40,60,80);
anim_1_x=new Array(20,20,17,36,60,78,90,92,93,98,108,120,133,152,181);
anim_1_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_2_x=new Array(20,20,2,3,4,5,6,7,8,9,10,12,13,15,18);
anim_2_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253);
anim_3_x=new Array(-20,-20,-2,-1,7,10,18,35,60,102,94,94,93,97,108,111,117,127);
anim_3_y=new Array(-20,-25,-64,-89,-104,-150,-173,-197,-213,-199,-151,-101,-66,-17,27,87,140,189);
anim_4_x=new Array(-20,-20,-10,-39,-30,-69,-64,-138,-154,-200,-181,-209,-191,-207,-203,-213,-202,-221,-211);
anim_4_y=new Array(-20,-20,-28,-51,-79,-100,-135,-154,-193,-183,-149,-134,-89,-60,8,51,107,157,201);
anim_5_x=new Array(-20,-29,-51,-72,-105,-133,-164,-189,-209,-229,-247,-270,-279,-282,-283,-283,-285,-286,-288);
anim_5_y=new Array(-20,-55,-86,-116,-154,-183,-205,-217,-217,-198,-169,-120,-44,-8,40,87,144,190,248);
anim_6_x=new Array(-20,-20,-7,14,44,79,143,186,217,226,234,244,250,259,265,274);
anim_6_y=new Array(-20,-21,-72,-113,-139,-166,-188,-181,-126,-68,-3,54,134,187,215,257);
anim_7_x=new Array(20,20,-3,-9,-13,-27,-33,-44,-54,-66,-77,-95,-107,-136,-150,-160,-164,-168,-171,-172,-172,-176,-175);
anim_7_y=new Array(-20,-26,-43,-63,-89,-116,-145,-169,-201,-222,-240,-253,-254,-245,-220,-195,-160,-124,-81,-53,-26,19,68);
anim_8_x=new Array(-20,20,-35,39,0,45,-1,24,-15,14,-20,35,-18,38,-11,16,49,64,81,93,100,103,109);
anim_8_y=new Array(-20,-20,-32,-42,-62,-76,-89,-107,-132,-147,-173,-180,-192,-209,-236,-193,-119,-73,-24,51,95,130,188);
anim_9_x=new Array(-20,-51,-89,-110,-165,-191,-228,-240,-259,-271,-277,-281,-287);
anim_9_y=new Array(-20,-20,-35,-37,-34,-16,10,47,105,150,189,227,273);
// End -->
</script>

第二步:把<body>改为
<body bgcolor="#fef4d9" OnLoad="initMouseEvents()">

第三步:在<body>区域中加入如下代码
<div id="sparks">
<div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">a</font></div>
<div id="sDiv1" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">b</font></div>
<div id="sDiv2" style="position:absolute; visibility: hidden;"><font face="arial black" color="blue">c</font></div>
<div id="sDiv3" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">d</font></div>
<div id="sDiv4" style="position:absolute; visibility: hidden;"><font face="arial black" color="orange">e</font></div>
<div id="sDiv5" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">f</font></div>
<div id="sDiv6" style="position:absolute; visibility: hidden;"><font face="arial black" color="green">g</font></div>
<div id="sDiv7" style="position:absolute; visibility: hidden;"><font face="arial black" color="skyblue">h</font></div>
<div id="sDiv8" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">i</font></div>
<div id="sDiv9" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">j</font></div>
</div>

这个是那个网站的脚本说明
第一步是在网页的head区插入代码
第二步
body里的bgcolor是规定整个页面的背景色,它的语法是直接在body里添加bgcolor属性;比如:你想把背景颜色设为red你可以这样添加代码:<body bgcolor="red">如果是其他颜色:<body bgcolor="#329734">#号后的六位数字都是16进制的
OnLoad="initMouseEvents()"《---是执行initMouseEvents这个js
第三步
DIV元素是用来为HTML文档内大块(block-level)的内容提供结构和背景的元素。DIV的起始标签和结束标签之间的所有内容都是用来构成这个块的,其中所包含元素的特性由DIV标签的属性来控制,或者是通过使用样式表格式化这个块来进行控制。
所以说 那个div是定义每一个字母位置标签
例如<div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">a</font></div>

div id="sDiv0"《---定义标签为sDiv0
style="position:absolute; visibility: hidden;"
position:absolute是将div的位置固定的,也就是用浏览器的绝对位置的显示div,只是浏览器的解释稍微不同,所以位置也不同了
visibility: hidden《--当visibility被设置为"hidden"的时候,元素虽然被隐藏了,但它仍然占据它原来所在的位置。
font face="arial black" color="red"
font face是设置字体的
color="red"是设置 红色的
现在看来下面这个语句
<div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">a</font></div>
是设置 字母啊的字体,颜色 平时被隐藏 当你点击是出现在你点击的位置

以上皆为手打 如果对楼主有帮助 希望楼主可以采纳 加分

10、js特效实现+号展开,鼠标点击后+旋转到×号,点击后可以收缩关闭

<div>标题 <span onclick="Cmd(this);">+</span></div>
<div id="div1" style="display:none;border:1px solid red;width:150px;height:200px;">
内容
</div>
<script>
function Cmd(v){
var div1 = document.getElementById("div1");
if(div1.style.display == "none"){
div1.style.display = "block";
v.innerHTML = "X";
}
else{
div1.style.display = "none";
v.innerHTML = "+";
}
}
</script>

如上代码可以实现,这是一个简单的方法,或者说是投机取巧的方法,如果想要+号和X号漂亮点,换成两张图片就OK了,不要跟我说你不会换啊  0.0

与网页设计鼠标特效免费js相关的知识