javascript开发系列(面向对像)
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(); }
</scr
相关文档:
String.prototype.HTMLEncode = function() {
var temp = document.createElement ("div");
(temp.textContent != null) ? (temp.textContent = this) : (temp.innerText = this);
var output = temp.innerHTML;
temp = null;
return output;
}
String.prototype.HTMLDecode = function() {
var temp = doc ......
var currItem = listbox.options[currIndex];
var prevItem = listbox.options[currIndex - 1];
&n ......
http://bei123wang.blog.163.com/blog/static/23175492009113022048840/
JavaScript 对象字面量
javascript 2009-12-30 14:20:48 阅读7 评论0 字号:大中小
JavaScript 对象字面量
在编程语言中,字面量是一种表示值的记法。例如,"Hello, World!" 在许多语言中都表示一个字符串字面量(string literal ),JavaScript ......
1: 遍历并输出Table中值
<table id="tb">
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</ ......
<SCRIPT LANGUAGE="JavaScript">
<!--
// Trim() , Ltrim() , RTrim()
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, "");
}
String.prototype.RTrim = functio ......