js 滚动式 弹出菜单

时间:2013-08-17 20:10:02  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读: /> <head>  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  <title>无标题文档</title>  <style type="text/css">  <!--  * {margin:0px; padding:0px}  #abc {      position:absolu...
  正文:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>无标题文档</title> 
<style type="text/Css"> 
<!-- 
* {margin:0px; padding:0px} 
#abc { 
    position:absolute; 
    left:155px; 
    top:5px; 
    width:200px; 
    height:370px; 
    z-index:1; 
    border: 5px solid #666666; 
    background-color: #CCCCCC; 
    overflow:hidden; 

--> 
</style>
</head>
<body> 
<div id="abc" onclick="opendiv()"> 
laksdflakjf<p>3453245353</p> 
</div>
<script> 
    document.getElementById("abc").style.left = "1248px"; 
    document.getElementById("abc").style.width="0px";
function closediv() 

    scrollpage2=setInterval(closediv2,5); 

function closediv2() 

    var l = parseInt(document.getElementById("abc").style.left) 
    var w = parseInt(document.getElementById("abc").style.width) 
    if (l>1245 || w<0) 
    { 
        clearInterval(scrollpage2); 
    }else{ 
        l = l + 3 
        document.getElementById("abc").style.left = (l)+"px"; 
        w = w - 2.5 
        document.getElementById("abc").style.width = (w)+"px";     
    } 
}    
function opendiv() 

    if(parseInt(document.getElementById("abc").style.width)>0) 
        scrollpage2=setInterval(closediv2,10); 
    else 
        scrollpage=setInterval(opendiv2,10); 
         

function opendiv2() 

    var l = parseInt(document.getElementById("abc").style.left) 
    var w = parseInt(document.getElementById("abc").style.width) 
    if (l<1050 || w>200) 
    { 
        clearInterval(scrollpage); 
    }else{ 
        l = l - 3 
        document.getElementById("abc").style.left = (l)+"px"; 
        w = w + 3.5 
        document.getElementById("abc").style.width = (w)+"px";     
    }
}     
</script> 
"js 滚动式 弹出菜单"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/26655.html


关于《js 滚动式 弹出菜单》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td