javascript 小技巧(自己总结)
2007-02-26 10:25
281 查看
1、 弹出窗口关闭时给出提示信息(在弹出的页面加上以下代码):
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function IsSureClose()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return event.returnValue='asdfasf';
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<body onbeforeunload="IsSureClose()">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</body>
2、JavaScript中window和document的区别:
document是window的一个子对象。window.document,因为window可以省略,所以一般只写document。似的还有window.history。window指窗体,document指页面。document是window的一个子对象。
window.open()和document.open()是完全不同的
window.open()是打开一个窗口,返回这个窗口的名称
而document.open()是用来打开输出流的,相对应的有document.close()来关闭输出流之间用document.write()来输出文本只是document.write()本来就可以打开输出流,所以document.open()其实可以不写的。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function IsSureClose()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return event.returnValue='asdfasf';
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<body onbeforeunload="IsSureClose()">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</body>
2、JavaScript中window和document的区别:
document是window的一个子对象。window.document,因为window可以省略,所以一般只写document。似的还有window.history。window指窗体,document指页面。document是window的一个子对象。
window.open()和document.open()是完全不同的
window.open()是打开一个窗口,返回这个窗口的名称
而document.open()是用来打开输出流的,相对应的有document.close()来关闭输出流之间用document.write()来输出文本只是document.write()本来就可以打开输出流,所以document.open()其实可以不写的。
相关文章推荐
- 成为JavaScript开发者的小技巧总结
- Javascript条件判断使用小技巧总结
- 自己总结的javascript基础知识
- 自己总结的一套JavaScript,希望对大家有用
- 自己常见的一些JavaScript兼容总结
- 总结自己使用shell命令行经常使用到的8个小技巧
- 自己常见的一些JavaScript兼容总结
- 总结自己使用shell命令行常用到的8个小技巧
- 自己总结web前端面试题之javascript
- javascript小技巧总结
- Javascript条件判断使用小技巧总结
- c#自己总结的几个常用的小技巧
- javascript小技巧总结
- 自己总结关于浏览器证书安全的二点小技巧
- 关于javascript事件总结和自己的心得体会
- javascript小技巧总结
- 网页制作Javascript经典小技巧总结
- Javascript 编程小技巧总结(部分内容借鉴他人)
- javascript小技巧总结