javascript中的面像对像。
请看代码,下面弹出一个对话筐。
<script type="text/javascript">
function win(w, h,,url)
{
this.width = 100;
this.height = 300;
this.time = 10;
this.url = url;
this.openWin = function()
{
var iTop = (window.screen.availHeight) / 2;
var iLeft = (window.screen.availWidth - 10 - w) / 2;
window.showModalDialog('open.htm', '', 'dialogHeight=' + this.height + ',dialogWidth=' + this.width + ',help=0;status=1;scroll=1');
}
}
function getWin() {
var objwin = new win(100, 100, 'open.html');
objwin.openWin();
}
window.onload = function() { getWin(); }
</script>
另外。js中的函数,相当灵活,可以存储于变量,对像,属性,方法中。等