1、是图片 一般就是准备两张图片 当鼠标放上去即显示另外一张图片 2、变换颜色如下所写,这个是变化背景颜色
原因是在html中加上文档类型(DOCTYPE)后判断屏幕坐标出错,网络上也有解决方法,就是去掉文档类型,这种治标不治本的方法我觉得很不合理,本人花了点时间修改了一下。经测试ie6、ie7、firefox2.0、firefox3.0 是没有任何问题的,其他的我没有测试。改后的压缩文件多了2KB左右,现在为16.2 KB。在目前的网络带宽下还是比较合理的。如果有需要我可以提供popup.js注释版。请相信博主是有分享精神的。 历史版本说明: V1.0.0 2008.07 从...
一、在IE6中使用PNG背景 IE6本身并不认识PNG图片的透明特性,虽然有让IE6支持PNG透明背景的JS程序: 代码如下:function correctPNG() { var arVersion = navigator.appVersion.split("MSIE") var version = parseFloat(arVersion[1]) if ((version >= 5.5) && (document.body.filters)) { for(var j=0; j<document.images.length; j++) { var img = document.images[j] var imgName = img.src.toUpperCase() if (imgName.substrin...
JavaScript Data Access Test function topDiv(el){ var elem=document.createElement("div"); elem.className="top-div"; //=========create img tag var img=document.createElement("img"); img.src=el.href; elem.appendChild(img); //=========create close DIV var closeDiv=document.createElement("div"); closeDiv.innerHTML="Close"; closeDiv.onclick=function(){ document.body.removeChild(elem); docume...
虽然有让IE6支持PNG透明背景的JS程序,都是不是很方便,还是用CSS来实现的好。使用到的就是:IE5.5+的AlphaImageLoader滤镜。 1.png背景透明 解决办法: 代码如下: #div1 { height: 600px; width: 260px; padding: 20px; background-repeat: repeat; } html>body #div1 { background-repeat: repeat;background-image: url(bj1.png); } * #div1 {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizin...
该 DIV是半秀明状态,这样可以看到背景也可以衬托文字,当鼠标放到文字上的时候,DIV层彻底不透明,文字清淅显示出来,一般这种效果都是要配合JavaScript的,这样兼容性会更好。 图片与文字结合的半透明效果,鼠标移上不透明 .box{ width:600px; height:600px; padding:20px;} *{ margin:0; padding:0;} body{ background:url(http://files.jb51.net/demoimg/200910/wall.gif) no-repeat; width:300px; height:235px;} .in_box{...
图片与JavaScript配合做出个性滚动条 * { margin:0; padding:0; } body { margin:20px 0 400px 20px; font:12px Arial; } h1 { font-size:14px; } ol { margin:20px; line-height:160%; } #out { position:relative; width:500px; height:300px; margin:100px 0 100px 80px; border:1px solid #369; overflow:hidden; } #content { width:520px; height:100%; overflow:auto; -moz-user-select:none; } #scrollB...
行如流水的Js文字背景特效 var message="脚本之家是一个专业的收集各类脚本学习资料的网站 jb51.net" var n=0; if (document.all){ document.write('') for (m=0;m'+message.charAt(m)+'') document.write('') var tempref=document.all.neonlight } else document.write(message) function neon(){ if (n==0){ for (m=0;m[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
function surfto(form) { var myindex=form.select1.selectedIndex if (form.select1.options[myindex].value != null) { parent.main.location.href=form.select1.options[myindex].value; } } //这段JS代码意为当前页面的浏览器地震// function shake(n) { if (window.top.moveBy) { for (i = 10; i > 0; i--) { for (j = n; j > 0; j--) { window.top.moveBy(0,i); window.top.moveBy(i,0); window.top.moveBy(0,-i);...
一些css的定义,可以根据需要自己选择。//显示单双行显示不同背景色【方法一】: // $("#UL_id li:even").attr("className","redClass"); //显示单双行显示不同背景色【方法二】: $("#UL_id li:even").addClass("redClass"); 单数 双数 双数 odd:单 even:双 jQuery 表格隔行变色代码li隔行换色改进版JS控制表格隔行变色
JavaScript未知高度元素的垂直居中的方法 function vMiddle(){ var middleDiv=document.getElementById("wrap"); var divHeight=middleDiv.offsetHeight; var bodyHeight=document.body.offsetHeight ; if(bodyHeight>divHeight) middleDiv.style.marginTop=-divHeight/2+"px"; else{ middleDiv.style.marginTop=0; middleDiv.style.top=0; } } html,body{height:100%;padding:0;margin:0;} #wrap{width:800px;margin:0...
JS+CSS实现的一种交互体验 @charset "gb2312"; /*元素初始值*/ html {background: #FFF;} body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td,ins,hr{margin: 0px;padding: 0px;} p{cursor: text;} h1,h2,h3,h4,h5,h6{font-size:100%;} ol,ul{list-style-type: none;} address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal;} table{border-collapse:col...
拖拽翻页效果JavaScript特效-demo by http://www.gxlcms.com html,body{ width:100%; height:100%; border:0px; margin:0px; overflow:hidden; } #menu{ width:1000px; height:500px; overflow:hidden; background:lightblue; } .page{ position:absolute; width:300px; height:400px; left:350px; top:50px; background:#FFF; border:1px solid #999; } ul{ list-style:none; height:320px; margin:20px; padding:0px; back...
前几天,在QQ群里有个XD问到bgsound的一些资料,确切地说是它的特殊用法。奇怪群里的人竟然都没几个能说出新意的,包括我!或许是这个标签不常用、或者是用处不大,所以,大家也就没有特意去研究过背景音乐吧。(以前自学这个东西时,本人也是仅仅出于好奇,玩玩而已^_^) 废话少说,来点真格的…… (以下是原文,不仅仅是bgsound哦,还有其他东东,慢慢see) 是用以插入背景音乐,但只适用於 IE,其参数设定不多。 src="your.m...
change(fn) 在每一个匹配元素的change事件中绑定一个处理函数。 change事件会在元素失去焦点的时候触发,也会当其值在获得焦点后改变时触发。 豪情 p{line-height:23px;margin:0;padding:0;} $(function(){ $('#c-obj select').change(function(){ alert($(this).attr('id') + ': ' + $(this).val()); $('p').css($(this).attr('id'), $(this).val()); //select的ID和要设置的CSS属性值必须保持一致 }); }); change(fn) 在每...