C语言 c++ php mysql nginx linux lnmp lamp lanmp memcache redis 面试 笔记 ppt 设计模式 问题 远程连接

滚动居中效果(frame版)

<!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=utf-8" />
<title>无标题文档</title>
<style>
.main{height:12000px; width:30px; background: orange; margin-left:90%;}
.main a{ padding:10px;}
</style>
</head>

<body>
<div class="main">

<?php
$map = array(0=>'O',1=>'A', 2=>'B', 3=>'C', 4=>'D', 5=>'E');

for($i=0;$i<501;$i++)
{
    $b = $i;
    $style = '';
    if($i%100 == 0)
    {
        $style = 'style="background:#F00; margin-left:30px;"';
        $c = $i/100;
        $b = $map[$c];
    }
    
    echo '<a id="target_'.$b.'" '.$style.' href="javascript:void(0);" onclick="centerWindow(\'http://www.baidu.com\', 400, 400)">'.$b.'</a>';
    echo "<br/>";
}

?>
</div>

</body>
<script>
function centerWindow(url, width, height)
{
/*

height    Number    设置窗体的高度,不能小于100
left    Number    说明创建窗体的左坐标,不能为负值
location    Boolean    窗体是否显示地址栏,默认值为no
resizable    Boolean    窗体是否允许通过拖动边线调整大小,默认值为no
scrollbars    Boolean    窗体中内部超出窗口可视范围时是否允许拖动,默认值为no
toolbar    Boolean    窗体是否显示工具栏,默认值为no
top    Number    说明创建窗体的上坐标,不能为负值
status    Boolean    窗体是否显示状态栏,默认值为no
width    Number    创建窗体的宽度,不能小于100

*/

    alert(screen.width);
    alert(screen.height);
    var left  = (screen.width-width)/2;
    var top   = (screen.height-height)/2;
    window.open(url, 'song',"width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes");
    
}

</script>
</html>

效果图:

  

 

 

 

posted on 2013-07-06 11:14  思齐_  阅读(519)  评论(0编辑  收藏  举报