您现在的位置:首页 >> 建站经验 >> 内容

最全的弹窗代码,强制弹出窗口实用代码总结(4)

时间:2010/4/3 23:27:30 点击:3314

  核心提示:其实代码非常简单: SCRIPT LANGUAGE='javascript' !-- window.open ('page.html') -- /SCRIPT 因为这是一段javascript代码,所以它们应该放在SCRIPT LANGUAGE ='javascript'标签和/script之间。!...

12、百页窗效果
  说明: 进入页面时,页面产生百页窗似的的效果
  代码:
<style>
<!--
.weiduomei_net{position:absolute;
left:0;
top:0;
layer-background-color:#3399ff;
background-color:#3399ff;
border:0.1px solid green
}
-->
</style>

<div id="i1" class="weiduomei_net"></div><div id="i2" class="weiduomei_net"></div><div id="i3"
class="weiduomei_net"></div><div id="i4" class="weiduomei_net"></div><div id="i5" class="weiduomei_net"></div><div
id="i6" class="weiduomei_net"></div><div id="i7" class="weiduomei_net"></div><div id="i8" class="weiduomei_net"></div>

<SCRIPT language=javascript>
<!--
var speed=30
var temp=new Array()
var temp2=new Array()
if (document.layers){
for (i=1;i<=8;i++){
temp=eval("document.i"+i+".clip")
temp2=eval("document.i"+i)
temp.width=window.innerWidth/8-0.3
temp.height=window.innerHeight
temp2.left=(i-1)*temp.width
}
}
else if (document.all){
var clipbottom=document.body.offsetHeight,cliptop=0
for (i=1;i<=8;i++){
temp=eval("document.all.i"+i+".style")
temp.width=document.body.clientWidth/8
temp.height=document.body.offsetHeight
temp.left=(i-1)*parseInt(temp.width)
}
}
function openit(){
window.scrollTo(0,0)
if (document.layers){
for (i=1;i<=8;i=i+2)
temp.bottom-=speed
for (i=2;i<=8;i=i+2)
temp.top+=speed
if (temp[2].top>window.innerHeight)
clearInterval(stopit)
}
else if (document.all){
clipbottom-=speed
for (i=1;i<=8;i=i+2){
temp.clip="rect(0 auto+"+clipbottom+" 0)"
}
cliptop+=speed
for (i=2;i<=8;i=i+2){
temp.clip="rect("+cliptop+" auto auto)"
}
if (clipbottom<=0)
clearInterval(stopit)
}
}
function www.wzp8.com(){
stopit=setInterval("openit()",100)
}
www.wzp8.com()

-->


</SCRIPT>

 


13、有滚动的文字说明 
  说明:鼠标放到链接上就会出现一个说明框,里面有滚动的文字说明
  代码:
<a href="http://www.tao536.com" target="_blank" onMouseOver="weiduomei_net_show(this,event,'看到了吧?')" onMouseOut="weiduomei_net_hide()">把鼠标放上来试试</a>
<div id="tooltip2" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:seashell">
<layer name="nstip" width="1000px" bgColor="seashell"></layer>
</div>
<SCRIPT language="javascript">
<!--
if (!document.layers&&!document.all)
event="test"
function weiduomei_net_show(current,e,text){

if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid #3399ff">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"
}

else if (document.layers){
document.tooltip2.document.nstip.document.write('<b>'+text+'</b>')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"
}
}
function weiduomei_net_hide(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"
}
}

function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150
}
//-->
</SCRIPT>

 

14、图片跟随着鼠标
  说明:图片跟随着鼠标,最好把图片做成透明的,那样效果更好
  代码:
<SCRIPT LANGUAGE="javascript">
var image="../images/helpor.gif"
var newtop=15
var newleft=15
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
else
{
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}

function weiduomei_net() {

layerName = 'iit'

eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')

if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}

document.onmousemove = weiduomei_net;

if (navigator.appName == "Netscape") {

}
else
{
document.write('<div ID="OuterDiv">')
document.write('<img ID="iit" src="'+image+'" STYLE="position:absolute;TOP:20pt;LEFT:20pt;Z-INDEX:20;visibility:hidden;">')
document.write('</div>')
}
</script> 

 

 

 

 

 

 


25、图片渐渐显隐
  说明: 图片渐渐显隐
  代码: <img src="UploadFiles/200601/20066404225734.gif" name="u" border="1" style="filter:alpha(opacity=0)">
<script language="javascript">

var b = 1;
var c = true;

function weiduomei_net(){
if(document.all);

if(c == true) {
b++;
}
if(b==100) {
b--;
c = false
}

if(b==10) {
b++;
c = true;
}

if(c == false) {
b--;
}
u.filters.alpha.opacity=0 + b;
setTimeout("weiduomei_net()",50);
}
weiduomei_net();
</script>

 

26、图片渐渐显示
  说明: 图片渐渐显示
  代码:
<img src="UploadFiles/200601/20066404225734.gif" border="1" id="weiduomei_net" style="visibility:hidden; FILTER:revealTrans(Duration=4.0, Transition=23);">
<SCRIPT FOR="window" EVENT="onLoad" LANGUAGE="vbscript">
weiduomei_net.filters.item(0).apply()
weiduomei_net.filters.item(0).transition = 12
weiduomei_net.Style.visibility = ""
weiduomei_net.filters(0).play(2.0)
</SCRIPT>

 

27、自由移动的图片 
  说明: 自由移动的图片
  效果: 看到了吗?
  代码:
<div id="weiduomei_net" style="position:absolute; visibility:visible; left:0px; top:0px; z-index:-1">
<img src="UploadFiles/200601/20066404225734.gif" border="0">
</div>
<SCRIPT LANGUAGE="javascript">
<!--
var isNS = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4));
var _all = '';
var _style = '';
var wwidth, wheight;
var ydir = '++';
var xdir = '++';
var id1, id2, id3;
var x = 1;
var y = 1;
var x1, y1;
if(!isNS) {
_all='all.';
_style='.style';
}
function www.wzp8.com() {
clearTimeout(id1);
clearTimeout(id2);
clearTimeout(id3);
if (isNS) {
wwidth = window.innerWidth - 55;
wheight = window.innerHeight - 50;
} else {
wwidth = document.body.clientWidth - 55;
wheight = document.body.clientHeight - 50;
}
id3 = setTimeout('randomdir()', 20000);
animate();
}
function randomdir() {
if (Math.floor(Math.random()*2)) {
(Math.floor(Math.random()*2)) ? xdir='--': xdir='++';
} else {
(Math.floor(Math.random()*2)) ? ydir='--': ydir='++';
}
id2 = setTimeout('randomdir()', 20000);
}
function animate() {
eval('x'+xdir);
eval('y'+ydir);
if (isNS) {
weiduomei_net.moveTo((x+pageXOffset),(y+pageYOffset))
} else {
weiduomei_net.pixelLeft = x+document.body.scrollLeft;
weiduomei_net.pixelTop = y+document.body.scrollTop;
}
if (isNS) {
if (weiduomei_net.top <= 5+pageYOffset) ydir = '++';
if (weiduomei_net.top >= wheight+pageYOffset) ydir = '--';
if (weiduomei_net.left >= wwidth+pageXOffset) xdir = '--';
if (weiduomei_net.left <= 5+pageXOffset) xdir = '++';
} else {
if (weiduomei_net.pixelTop <= 5+document.body.scrollTop) ydir = '++';
if (weiduomei_net.pixelTop >= wheight+document.body.scrollTop) ydir = '--';
if (weiduomei_net.pixelLeft >= wwidth+document.body.scrollLeft) xdir = '--';
if (weiduomei_net.pixelLeft <= 5+document.body.scrollLeft) xdir = '++';
}
id1 = setTimeout('animate()', 30);
}
var weiduomei_net=eval('document.'+_all+'weiduomei_net'+_style);
// -->
</script>


再把<body>改为:
<body OnLoad="www.wzp8.com()" OnResize="www.wzp8.com()">

 

28、随鼠标触动而变化
  说明: 鼠标接触或者离开图片时,图片大小会相应变化 
  代码:
<span id="s1" style = "width : 150"><a href="http://www.tao536.com" target="_blank" onmouseover="www.wzp8.com.style.width='200';" onmouseout="www.wzp8.com.style.width= '150';"><Img src="UploadFiles/200601/20066404225734.gif" id="www.wzp8.com"></a></span>

 

29、javascript的容错脚本
  说明: javascript的容错脚本,有了它,你的页面就不会出现错误提示了。 
  代码:
<SCRIPT LANGUAGE="javascript">
<!--
function weiduomei_net() {
return true;
}
window.onerror = weiduomei_net();
// -->
</SCRIPT>

作者:不详 来源:网络
相关评论
发表我的评论
  • 大名:
  • 内容:
  • 网址铺吧网址导航-站长之家(www.wzp8.com/news) © 2009 版权所有 All Rights Reserved.
  • Email:xiegr71@163.com 站长QQ:329700870 京ICP备07500142号