手机、游戏在线直充

Jquery DIV+javascript自适应大小窗口

 可根据加载到窗口里的目标页面大小自动调窗口大小,简要代码如下:

test.html源码:

 

test.html
<!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>
    
<title></title>
    
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
    
<script type="text/javascript" src="popwin.js"></script>
    
<script type="text/javascript">
        $(document).ready(
function() {
            $(
'#popshow').popshow_window('<div id="gedit"></div>');
            $(
'#btn').click(function() {
                win_show(
'test1.html');
            });
            $(
'#btn1').click(function() {
                win_show(
'test2.html');
            });
            
function win_show(url) {
                $(
"#gedit").html('');
                startDownload(url, 
function(s) {
                    $(
'#gedit').html(s);
                });
                openpopshow();
            }
        });
    
</script>
</head>
<body>
    
<div id="popshow" style="cursor: pointer">
    
</div>
    
<input type="button" id="btn" value="300x300" />
    
<input type="button" id="btn1" value="600x600" />
</body>
</html>

 test1.html源码:

test1.html

 

test2.html源码:

test2.html
<html>
<head>
    
<title></title>
</head>
<body>
<div style="width:50px;height:65px">
50x65
    
<input type="button" value="Close" onclick="close_window();" />
</div>
</body>
</html>

 

popwin.js

 

注:此代码正常运行还需要jquery.js,地址:http://code.jquery.com/latest-jquery.js

posted on 2008-12-18 20:24  ljping  阅读(5018)  评论(0)    收藏  举报

导航

手机、游戏在线直充