B/S学习之路—DOM(1)

来源:互联网 发布:芜湖网络推广公司 编辑:程序博客网 时间:2024/06/05 01:54

【01对话框】

代码:

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <script>        //alert('123');//提示框,只有一个“确定”按钮        //确认框,有“确定”、“取消”两个按钮        //点确定返回true,点取消返回false        //var result = confirm('确定要删除吗?');        //alert(result);        //输入框:有一个文本框,一个“确定”按钮,一个“取消”按钮        //点确定则返回文本框中的值,点取消则返回null        //var result = prompt('请输入年龄', '10');        //alert(result);    </script></head><body>    </body></html>
执行效果:


点击确定弹出:↓


点击取消弹出:



点击确定弹出:↓


【02location页面跳转】

代码:

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <script>        //将地址栏的url进行改写,效果是可以完成页面跳转        location.href = '01对话框.html';    </script></head><body></body></html>
执行效果:
直接跳到01对话框.html页面。

原创粉丝点击