`
- 浏览:
254254 次
- 性别:
- 来自:
上海
-

/**//*
*Write by:惠万鹏
*Time :2008-09-01
*vision :1.0
*/
//-------------------------------------------------------------------------
//a function of inint a select

var GangSelect =
{

/**//**
*Description : this function initiates select of object
*/
__initiateSelect : function(aValueTexts, oSelect, sInitValue, isSort)

{
if (isSort)

{
aValueTexts.sort();
}

/**//** remove all options of select of object */
oSelect.length = 0;
for (var i = 0; i < aValueTexts.length; i = i + 1)

{
var sValue = aValueTexts[i].substring(0,
aValueTexts[i].indexOf(":"));
var sText = aValueTexts[i].substring(
aValueTexts[i].indexOf(":") + 1, aValueTexts[i].length);

/**//** create element of option */
var oOption = document.createElement("option");
oOption.value = sValue;

/**//** initiates a option*/
if (sValue == sInitValue)

{
oOption.selected = true;
}
var oText = document.createTextNode(sText);
oOption.appendChild(oText);
oSelect.appendChild(oOption);
}
},

/**//**
*this function of initiates the first select
*/
__initFirtSelect : function(sFirstValueTexts,
sInitiateFirstSelectValue, sFirstSelectId)

{
var aFirstValueTexts = sFirstValueTexts.split('|');
aFirstValueTexts.unshift('-1:请选择');
var oFirstSelect = obj$(sFirstSelectId);

/**//** initiates select */
this.__initiateSelect(aFirstValueTexts, oFirstSelect,
sInitiateFirstSelectValue, false);
},

/**//**
*this function of init the second select
*/
__initSecondSelect : function(sSecondValueTexts,
sInitiateSecondSelectValue, sFirstSelectId, sSecondSelectId)

{
var sFirstSelectedValue = obj$(sFirstSelectId).value;
var aTemp = new Array();
var aSecondValueTexts = sSecondValueTexts.split('|');
for (var k = 0; k < aSecondValueTexts.length; k = k + 1)

{
if (aSecondValueTexts[k].split('_')[0] == sFirstSelectedValue)

{
aTemp.push(aSecondValueTexts[k]);
}
}
aTemp.unshift('-1:请选择');
var oSecondSelect = obj$(sSecondSelectId);
this.__initiateSelect(aTemp, oSecondSelect,
sInitiateSecondSelectValue, false);
},
//this function of use in big select's onchange event
Change : function (sSecondValueTexts,sFirstSelectId,sSecondSelectId)

{
this.__initSecondSelect(sSecondValueTexts,"NOVALUE",
sFirstSelectId, sSecondSelectId);
},
//this function of init the big and small select
Initiate : function(sFirstValueTexts,sSecondValueTexts,sFirstSelectId,
sSecondSelectId,sInitiateFirstSelectValue, sInitiateSecondSelectValue)

{
var initiateFirstValue = 'NOVALUE';
var initiateSecondValue = 'NOVALUE';
if(arguments.length == 5)

{
initiateFirstValue = sInitiateFirstSelectValue;
}
else if(arguments.length == 6)

{
initiateFirstValue = sInitiateFirstSelectValue;
initiateSecondValue = sInitiateSecondSelectValue;
}
this.__initFirtSelect(sFirstValueTexts,
sInitiateFirstSelectValue,sFirstSelectId);
this.__initSecondSelect(sSecondValueTexts,sInitiateSecondSelectValue,
sFirstSelectId,sSecondSelectId);
}
};
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
JavaScript二级联动菜单是一种常见的网页交互设计,用于提供更精细化的导航或数据筛选。在电子商务网站、行政管理系统等中,我们经常可以看到这种菜单形式,它能够根据用户在一级菜单中的选择,动态加载并显示相应的...
js 二级联动菜单 路过的高手指点,低手分享js 二级联动菜单 路过的高手指点,低手分享
javascript 二级联动菜单
在本案例中,"js二级联动菜单"是指利用JavaScript实现的一种下拉菜单功能,这种菜单通常出现在网站导航中,当用户选择一级菜单时,相关的二级菜单会自动展开,提供更具体的选项。 一级和二级联动菜单的实现主要涉及...
本文将深入探讨如何使用DIV、CSS和JavaScript实现一个鼠标离开时自动跳回首页的二级联动菜单。 首先,我们需要理解这些技术的基础概念。`DIV`是HTML中的一个块级元素,常用来组织页面布局。`CSS`(层叠样式表)用于...
在IT领域,二级联动菜单是一种常见的用户界面设计元素,它常用于导航或数据筛选,特别是在网站和应用程序中。二级联动菜单通常由两个关联的下拉菜单组成,其中一个菜单的选择会影响另一个菜单的内容。这种交互设计...
在本场景中,"ASP+ACC二级联动菜单"是指使用ASP技术和Microsoft Access(ACC)数据库构建的二级交互式下拉菜单。这个菜单系统通常会在用户选择一级菜单项时动态加载并显示相应的二级菜单项,提供更流畅的用户体验。 ...
在ASP(Active Server Pages)开发中,二级联动菜单是一种常见的交互设计,用于提供层次结构的选项选择,例如在产品分类、地区选择等场景。在这个案例中,我们将探讨如何使用ASP和数据库来实现一个二级联动菜单。 ...
总的来说,"asp无刷新二级联动菜单"是结合了ASP、JavaScript和Ajax技术,提供高效、流畅的用户界面,使得用户在选择地区或类别时无需等待整个页面刷新,极大地提升了网页的交互性和效率。这种技术在电商网站、信息...
在二级联动菜单的实现中,JavaScript主要负责监听一级菜单的`change`事件,当事件触发时,根据用户选择的一级菜单值,动态生成或更新二级菜单的内容。这通常涉及到DOM(文档对象模型)操作,包括`getElementById`、`...
在IT领域,二级联动菜单是一种常见的用户界面设计模式,它用于提供更为精细化的筛选或选择功能。在这种菜单中,选择一级菜单的一项会触发二级菜单的显示,二级菜单中的选项通常与一级菜单的选择有关联。这样的设计...
本示例中,我们关注的是“js实现的二级菜单联动”,特别是省市联动的应用。省市联动意味着当用户在一级菜单(省份)中选择一个选项时,二级菜单(城市)会动态更新显示与所选省份相关联的城市列表。这种功能可以极大...
这个"一个和数据库关联的,二级联动菜单示例ajax实现"是一个实用的代码示例,它展示了如何利用AJAX(异步JavaScript和XML)技术动态加载并更新二级菜单的内容,根据用户在一级菜单中的选择。 首先,我们来理解一下...
下面将详细介绍这种二级联动菜单的实现原理、步骤以及相关的jQuery知识。 首先,联动菜单的基本概念是:当用户在一个下拉菜单(一级菜单)中选择某个选项时,另一个下拉菜单(二级菜单)的内容会根据所选的选项动态...
本文实例为大家分享了js实现select二级联动下拉菜单,供大家参考,具体内容如下 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath()...
本文将详细介绍一个基于JavaScript(简称JS)和Active Server Pages(简称ASP)实现的二级联动菜单案例。 #### 二、技术栈简介 - **JavaScript**:一种轻量级的解释型或即时编译型的编程语言,广泛应用于客户端脚本...
二级联动菜单 参考 javascript,为对二级菜单陌生的程序员提供范例。
四级联动菜单作为一种高级导航设计,通过JavaScript实现,能够根据用户的逐级选择动态更新下一级菜单选项,极大地增强了交互性和功能性。 #### 核心知识点: **1. 联动菜单的基本概念** 联动菜单是指一个菜单项的...