1
2
<div id='div' style="display:none">123123</div>
<input type="button" id="btn" value="显示" />
javascript代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
var div = document.getElementById('div')//进行显示/隐藏的区域
var btn = document.getElementById('btn')//控制按钮
var txt
btn.onclick = function (){
txt = this.value
if(txt==='显示'){
div.style.display = 'block'
this.value = '隐藏'
}else{
div.style.display = 'none'
this.value = '显示'
JS控制浏览器窗口的大小代码之一:<script>
window.moveTo(0, 0)//移动窗口
window.resizeTo(800, 600)//改变大小
window.onresize=new Function("window.resizeTo(800, 600)")
</script>
JS控制浏览器窗口的大小代码之二:
<SCRIPT>
if (window != top) top.location.href = location.href
self.resizeTo(800,600)
</SCRIPT>
JS控制浏览器窗口的大小代码之三:
<script language="javascript">
function openWin()
{
var i=0
i = open("","","width=500,height=500")
}
</script>
JS控制浏览器窗口的大小代码之四:
<SCRIPT language=JavaScript>
var new_width=800//你要固定的浏览器宽度
var new_height=600//你要固定的浏览器高度
function resizewindow()
{
window.resizeTo(new_width,new_height)
}
resizewindow()
</SCRIPT>