WEB开发网
开发学院网页设计JavaScript JavaScript方法和技巧大全——窗口和框架 阅读

JavaScript方法和技巧大全——窗口和框架

 2010-09-14 13:39:52 来源:WEB开发网   
核心提示:改变浏览器状态栏文字提示1<script language=”JavaScript”>2 window.status = “A new status message”;3</script>弹出确认提示框1<script language=&r

改变浏览器状态栏文字提示
1<script language=”JavaScript”>
2 window.status = “A new status message”;
3</script>

弹出确认提示框

1<script language=”JavaScript”>
2 var userChoice = window.confirm(“Click OK or Cancel”);
3 if (userChoice) { 
4 document.write(“You chose OK”);
5 } else { 
6 document.write(“You chose Cancel”);
7 }
8</script>

提示输入
1<script language=”JavaScript”>
2 var userName = window.prompt(“Please Enter Your Name”,”Enter Your Name Here”);
3 document.write(“Your Name is “ + userName);
4</script>

打开一个新窗口
1<script language=”JavaScript”>
2 //打开一个名称为myNewWindow的浏览器新窗口
3 window.open(“http://www.liu21st.com/”,”myNewWindow”);
4</script>

设置新窗口的大小

1<script language=”JavaScript”>
2 window.open(“http://www.liu21st.com/”,”myNewWindow”,'height=300,width=300');
3</script>

设置新窗口的位置

1<script language=”JavaScript”>
2 window.open(“http://www.liu21st.com/”,”myNewWindow”,'height=300,width=300,left=200,screenX=200,top=100,screenY=100');
3</script>

1 2 3  下一页

Tags:JavaScript 方法 技巧

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接