この記事では、Web Windowsを中央と下部に拡張するためのJS実装の方法について説明します。参照のためにそれを共有してください。特定の分析は次のとおりです。
このページは中央から表示され、ゆっくりと上下に拡大しますが、これは悪くありません。コードは次のとおりです。
次のようにコードをコピーします:<html>
<head>
<title> jsは、拡張された中間のWebウィンドウを表示します</title>
<style>
<! -
.intro {
位置:絶対;
左:0;
上:0;
レイヤーバックグラウンドカラー:黄色。
バックグラウンドカラー:#336699;
国境:0.1pxソリッド#336699
}
- >
</style>
</head>
<body>
<div id = "i1"> </div> <div id = "i2"> </div>
<スクリプト言語= "javascript1.2">
var速度= 20
var temp = new array()
var temp2 = new array()
if(document.layers){
for(i = 1; i <= 2; i ++){
temp [i] = eval( "document.i"+i+"。クリップ")
temp2 [i] = eval( "document.i"+i)
temp [i] .width = window.innerwidth
temp [i] .height = window.innerheight/2
temp2 [i] .top =(i-1)*temp [i] .height
}
}
else if(document.all){
var Clipbottom = document.body.offsetheight/2、cliptop = 0
for(i = 1; i <= 2; i ++){
temp [i] = eval( "document.all.i"+i+"。スタイル")
temp [i] .width = document.body.clientWidth
temp [i] .height = document.body.offsetheight/2
temp [i] .top =(i-1)*parseint(temp [i] .height)
}
}
function openit(){
window.scrollto(0,0)
if(document.layers){
温度[1] .bottom- =速度
temp [2] .top+=速度
if(temp [1] .bottom <= 0)
ClearInterval(stopit)
}
else if(document.all){
Clipbottom- =速度
temp [1] .clip = "rect(0 auto+"+clipbottom+"0)"
cliptop+=速度
temp [2] .clip = "rect("+cliptop+"auto auto)"
if(clipbottom <= 0)
ClearInterval(stopit)
}
}
function gogo(){
stopit = setInterval( "openit()"、100)
}
ゴーゴー()
</script>
</body>
</html>
この記事がすべての人のGO言語プログラミングに役立つことを願っています。