JavaScript 三级级联菜单
< HTML >
< HEAD >
< TITLE > 合同申请 </ TITLE >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< SCRIPT LANGUAGE = JavaScript >
/* * Define object Dsy 构造器
fieldValues - 三个表单域的名称, 可以通过 request.getParameter(xxx) 取值
defalutOptions - 默认选项
*/
function Dsy(fieldValues, defalutOptions){
this .Items = {};
this .defalutOptions = defalutOptions; // 默认选项
this .fieldValues = fieldValues; // 三个表单域的名称
}
Dsy.prototype.add = function (id, iArray){
this .Items[id] = iArray;
}
Dsy.prototype.Exists = function (id){
if ( typeof ( this .Items[id]) == " undefined " )
return false ;
return true ;
};
Dsy.prototype.setup = function () {
this .bean_change( 0 );
}
// This prototype method added by BeanSoft Studio
Dsy.prototype.bean_change = function (v){
var str = " 0 " ;
for (i = 0 ; i < v; i ++ ){
str += ( " _ " + (document.getElementById( this .fieldValues[i]).selectedIndex - 1 ));
};
var ss = document.getElementById( this .fieldValues[v]);
// Avoid a null exception
if (ss == null ) return ;
with (ss){
length = 0 ;
options[ 0 ]&nb
相关文档:
1.大家在实际工作中,会写各式各样的赋值语句。
比如最常用的obj.style.display = "none";
如果这样的赋值语句一多,obj.style一排下来都要看晕了
下面我的base.js中的extend函数可以允许用json格式赋值属性甚至是函数句柄
/**
* 扩展函数
* @param target 需要扩展的对象
* @para ......
1. SproutCore
SproutCore 苹果对SproutCore的解释为“开源,平台无关,类Cocoa的JavaScript框架,用于创建具有桌面应用程序外观和操作感的Web应用程序。”
SproutCore demonstrations: Photos, Sample Controls
2. Spry
Spry 是Adobe 的 Ajax framework. Spry的目的是成为实现Ajax的一种简单方式,对HTML、C ......
javascript中的面像对像。
请看代码,下面弹出一个对话筐。
<script type="text/javascript">
function win(w, h,,url)
{
this.widt ......
数组属于JavaScript中的复合数据类型。
JavaScript中一个数组可以存储JavaScript支持的任何数据类型,比如可以用一个数组来处理用户从中选择的项目列表,或者一组图像坐标,或者一组图片的引用。
创建Array对象并初始化 ......
JavaScript 中使用 replace 达到 replaceAll的效果
方法: string.replace(new RegExp(oldString,"gm"),newString))
gm g=global, m=multiLine , 大致上方法就是这样的,可以实现替换全部指定字串
另一个简单的验证JS的方法:
在浏览器地址栏输入
javascript:alert("abcabc ......