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可在網上下載
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>如上代碼可以實現,這是一個簡單的方法,或者說是投機取巧的方法,如果想要+號和X號漂亮點,換成兩張圖片就OK了,不要跟我說你不會換啊 0.0