javaScript获取页面,屏幕等高度与宽度
//获取页面数据
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else{ // Explorer Macwould also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
 
相关文档:
在类的构造函数中添加
EnableAutomation();
在OnInitDialog中添加
SetExternalDispatch(GetIDispatch(TRUE));
在类的声明中添加宏
DECLARE_DISPATCH_MAP()
在类的实现文件中添加组宏
BEGIN_DISPATCH_MAP(当前类, 基类)
END_DISPATCH_MAP()
然后就可以用 DISP_FUNCTION宏来映射导出函 ......
JavaScript就这么回事1:基础知识
1 创建脚本块
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 隐藏脚本代码
1: <script language=”JavaScript”>
2: <!--
3: document.write(“Hello”);
4: // -->
5: </script ......
javascript调用父窗口(父页面)的方法
window.parent与window.opener的区别 javascript调用主窗口方法
1: window.parent 是iframe页面调用父页面对象
举例:
a.html
Html代码
<html>
<head><title>父页面</title></head> &nb ......
JavaScript基础
stringObject.charAt(index)方法:返回指定索引位置处的字符。
stringObject.slice(start,[end])和stringObject.substring(start,[end])方法都接受两个参数,分别为子字符串的起始位置和终止位置,返回这两者之间的字符串,不包括终止位置的那个字符串。如果不指定第二个参数,则默认为字符串的长度,即 ......