`

js的级联菜单

    博客分类:
  • js
阅读更多

<html>
<head>
<title>businessSell</title>
</head>

<body onLoad="changeDrop2()">
<script LANGUAGE="JavaScript">
function changeDrop2() {
if (document.form.Drop1.selectedIndex == 0) {
 document.form.Drop2.length = 1;
 document.form.Drop1.selectedIndex = 0
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "No Product Selected";
 document.form.Drop2.options[0].value = "No Product Selected";
}
if (document.form.Drop1.selectedIndex == 1) {
 document.form.Drop2.length = 9;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "Celebrity";
 document.form.Drop2.options[1].value = "Celebrity";
 document.form.Drop2.options[2].text = "Legend";
 document.form.Drop2.options[2].value = "Legend";
 document.form.Drop2.options[3].text = "Sundancer";
 document.form.Drop2.options[3].value = "Sundancer";
 document.form.Drop2.options[4].text = "SideKick";
 document.form.Drop2.options[4].value = "SideKick";
 document.form.Drop2.options[5].text = "Rally";
 document.form.Drop2.options[5].value = "Rally";
 document.form.Drop2.options[6].text = "Shuttle";
 document.form.Drop2.options[6].value = "Shuttle";
 document.form.Drop2.options[7].text = "Dynamo";
 document.form.Drop2.options[7].value = "Dynamo";
 document.form.Drop2.options[8].text = "XL";
 document.form.Drop2.options[8].value = "XL";
 }
if (document.form.Drop1.selectedIndex == 2) {
 document.form.Drop2.length = 8;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "1100";
 document.form.Drop2.options[1].value = "1100";
 document.form.Drop2.options[2].text = "1103";
 document.form.Drop2.options[2].value = "1103";
 document.form.Drop2.options[3].text = "1105";
 document.form.Drop2.options[3].value = "1105";
 document.form.Drop2.options[4].text = "1115";
 document.form.Drop2.options[4].value = "1115";
 document.form.Drop2.options[5].text = "1120";
 document.form.Drop2.options[5].value = "1120";
 document.form.Drop2.options[6].text = "1170";
 document.form.Drop2.options[6].value = "1170";
 document.form.Drop2.options[7].text = "1400";
 document.form.Drop2.options[7].value = "1400";
 }
if (document.form.Drop1.selectedIndex == 3) {
 document.form.Drop2.length = 12;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "TMR48";
 document.form.Drop2.options[1].value = "TMR48";
 document.form.Drop2.options[2].text = "TMR49";
 document.form.Drop2.options[2].value = "TMR49";
 document.form.Drop2.options[3].text = "TMR348";
 document.form.Drop2.options[3].value = "TMR348";
 document.form.Drop2.options[4].text = "TMR329";
 document.form.Drop2.options[4].value = "TMR329";
 document.form.Drop2.options[5].text = "TMR540";
 document.form.Drop2.options[5].value = "TMR540";
 document.form.Drop2.options[6].text = "TMR360";
 document.form.Drop2.options[6].value = "TMR360";
 document.form.Drop2.options[7].text = "TMR470";
 document.form.Drop2.options[7].value = "TMR470";
 document.form.Drop2.options[8].text = "TMR570/571";
 document.form.Drop2.options[8].value = "TMR570/571";
 document.form.Drop2.options[9].text = "TMR580";
 document.form.Drop2.options[9].value = "TMR580";
 document.form.Drop2.options[10].text = "TMR670";
 document.form.Drop2.options[10].value = "TMR670";
 document.form.Drop2.options[11].text = "TMR560";
 document.form.Drop2.options[11].value = "TMR560";
 }
if (document.form.Drop1.selectedIndex == 4) {
 document.form.Drop2.length = 3;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "Wrangler";
 document.form.Drop2.options[1].value = "Wrangler";
 document.form.Drop2.options[2].text = "Hurricane";
 document.form.Drop2.options[2].value = "Hurricane";
 }
if (document.form.Drop1.selectedIndex == 5) {
 document.form.Drop2.length = 3;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "2000";
 document.form.Drop2.options[1].value = "2000";
 document.form.Drop2.options[2].text = "3000";
 document.form.Drop2.options[2].value = "3000";
 }

}

function goThere() {
if (document.form.Drop1.selectedIndex == 0) {
 alert("Please Select a Product");
 } else {
 if (document.form.Drop2.selectedIndex == 0) {
  alert("Please Select a Model");
  } else {
  var list1 = document.form.Drop1;
  var list2 = document.form.Drop2;
  var theDIR = list1.options[list1.selectedIndex].value;
  var theProduct = document.form.Drop2.options[list2.selectedIndex].value;
  location.href = "
http://www.YourLinkHere.com/ " + theDIR + "/" + theProduct + ".htm";
  }
 }
}

</script>


<form name="form">
  <p><select name="Drop1" onChange="changeDrop2()" size="1">
    <option selected value="Select A Product">Select A Product</option>
    <option value="Scooters">Scooters</option>
    <option value="Jazzy">Jazzy</option>
    <option value="LiftChairs">Lift Chairs</option>
    <option value="PMVs">PMV's</option>
    <option value="Hercules">Hercules</option>
  </select><br>
  <select name="Drop2" size="1">
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
  </select><br>
  <input type="button" onClick="goThere()" value="GOTO Product Page" name="B1"></p>
</form>

<xmp>
<html>
<head>
<title>businessSell</title>
</head>

<body onLoad="changeDrop2()">
<script LANGUAGE="JavaScript">
function changeDrop2() {
if (document.form.Drop1.selectedIndex == 0) {
 document.form.Drop2.length = 1;
 document.form.Drop1.selectedIndex = 0
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "No Product Selected";
 document.form.Drop2.options[0].value = "No Product Selected";
}
if (document.form.Drop1.selectedIndex == 1) {
 document.form.Drop2.length = 9;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "Celebrity";
 document.form.Drop2.options[1].value = "Celebrity";
 document.form.Drop2.options[2].text = "Legend";
 document.form.Drop2.options[2].value = "Legend";
 document.form.Drop2.options[3].text = "Sundancer";
 document.form.Drop2.options[3].value = "Sundancer";
 document.form.Drop2.options[4].text = "SideKick";
 document.form.Drop2.options[4].value = "SideKick";
 document.form.Drop2.options[5].text = "Rally";
 document.form.Drop2.options[5].value = "Rally";
 document.form.Drop2.options[6].text = "Shuttle";
 document.form.Drop2.options[6].value = "Shuttle";
 document.form.Drop2.options[7].text = "Dynamo";
 document.form.Drop2.options[7].value = "Dynamo";
 document.form.Drop2.options[8].text = "XL";
 document.form.Drop2.options[8].value = "XL";
 }
if (document.form.Drop1.selectedIndex == 2) {
 document.form.Drop2.length = 8;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "1100";
 document.form.Drop2.options[1].value = "1100";
 document.form.Drop2.options[2].text = "1103";
 document.form.Drop2.options[2].value = "1103";
 document.form.Drop2.options[3].text = "1105";
 document.form.Drop2.options[3].value = "1105";
 document.form.Drop2.options[4].text = "1115";
 document.form.Drop2.options[4].value = "1115";
 document.form.Drop2.options[5].text = "1120";
 document.form.Drop2.options[5].value = "1120";
 document.form.Drop2.options[6].text = "1170";
 document.form.Drop2.options[6].value = "1170";
 document.form.Drop2.options[7].text = "1400";
 document.form.Drop2.options[7].value = "1400";
 }
if (document.form.Drop1.selectedIndex == 3) {
 document.form.Drop2.length = 12;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "TMR48";
 document.form.Drop2.options[1].value = "TMR48";
 document.form.Drop2.options[2].text = "TMR49";
 document.form.Drop2.options[2].value = "TMR49";
 document.form.Drop2.options[3].text = "TMR348";
 document.form.Drop2.options[3].value = "TMR348";
 document.form.Drop2.options[4].text = "TMR329";
 document.form.Drop2.options[4].value = "TMR329";
 document.form.Drop2.options[5].text = "TMR540";
 document.form.Drop2.options[5].value = "TMR540";
 document.form.Drop2.options[6].text = "TMR360";
 document.form.Drop2.options[6].value = "TMR360";
 document.form.Drop2.options[7].text = "TMR470";
 document.form.Drop2.options[7].value = "TMR470";
 document.form.Drop2.options[8].text = "TMR570/571";
 document.form.Drop2.options[8].value = "TMR570/571";
 document.form.Drop2.options[9].text = "TMR580";
 document.form.Drop2.options[9].value = "TMR580";
 document.form.Drop2.options[10].text = "TMR670";
 document.form.Drop2.options[10].value = "TMR670";
 document.form.Drop2.options[11].text = "TMR560";
 document.form.Drop2.options[11].value = "TMR560";
 }
if (document.form.Drop1.selectedIndex == 4) {
 document.form.Drop2.length = 3;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "Wrangler";
 document.form.Drop2.options[1].value = "Wrangler";
 document.form.Drop2.options[2].text = "Hurricane";
 document.form.Drop2.options[2].value = "Hurricane";
 }
if (document.form.Drop1.selectedIndex == 5) {
 document.form.Drop2.length = 3;
 document.form.Drop2.selectedIndex = 0
 document.form.Drop2.options[0].text = "Select Model";
 document.form.Drop2.options[0].value = "Select Model";
 document.form.Drop2.options[1].text = "2000";
 document.form.Drop2.options[1].value = "2000";
 document.form.Drop2.options[2].text = "3000";
 document.form.Drop2.options[2].value = "3000";
 }

}

function goThere() {
if (document.form.Drop1.selectedIndex == 0) {
 alert("Please Select a Product");
 } else {
 if (document.form.Drop2.selectedIndex == 0) {
  alert("Please Select a Model");
  } else {
  var list1 = document.form.Drop1;
  var list2 = document.form.Drop2;
  var theDIR = list1.options[list1.selectedIndex].value;
  var theProduct = document.form.Drop2.options[list2.selectedIndex].value;
  location.href = "
http://www.YourLinkHere.com/ " + theDIR + "/" + theProduct + ".htm";
  }
 }
}

</script>


<form name="form">
  <p><select name="Drop1" onChange="changeDrop2()" size="1">
    <option selected value="Select A Product">Select A Product</option>
    <option value="Scooters">Scooters</option>
    <option value="Jazzy">Jazzy</option>
    <option value="LiftChairs">Lift Chairs</option>
    <option value="PMVs">PMV's</option>
    <option value="Hercules">Hercules</option>
  </select><br>
  <select name="Drop2" size="1">
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
    <option value=" ">-----------------------------</option>
  </select><br>
  <input type="button" onClick="goThere()" value="GOTO Product Page" name="B1"></p>
</form>

</body>
</html>
</xmp>
</body>
</html>

分享到:
评论

相关推荐

    javascript 级联菜单

    JavaScript级联菜单是一种常见的网页交互元素,用于呈现层次结构的数据,如导航菜单、下拉选项等。这种菜单在用户界面上提供了高效的导航,允许用户通过展开和折叠子菜单来探索多级内容。在这个主题中,我们将深入...

    js级联菜单示例

    在JavaScript的世界里,级联菜单(Cascading Menu)是一种常见的交互设计,它通常用于下拉选择框,其中的选择项会根据用户先前的选择动态改变。本示例将深入讲解如何利用jQuery库来实现这种功能。jQuery是JavaScript...

    js加html编写的级联菜单

    总结,js和html编写的级联菜单结合了前端和后端的技术,通过JavaScript实现了动态交互和数据获取,HTML提供了结构基础,而数据库则为菜单提供了数据源。这种技术组合使得网页可以提供丰富的交互性和实时性,极大地...

    级联菜单 动态级联菜单

    级联菜单的工作原理是基于客户端的javascript脚本和服务器端的数据库交互。用户选择了一个选项,然后javascript脚本将该选项的值传递给服务器,服务器端的脚本将根据该值从数据库中查询相关数据,并将其返回给客户端...

    js 级联菜单例子

    js 级联菜单例子,简单实用

    jsp+db的js级联菜单

    在本项目"jsp+db的js级联菜单"中,我们看到它利用了Java Server Pages (JSP) 和 JavaScript 技术,并结合数据库来动态生成级联菜单。 JSP是Java的一种视图技术,用于在服务器端生成HTML或其他类型的Web内容。开发者...

    jsp实现级联菜单 jsp实现级联菜单

    通过上述步骤,我们已经了解了如何使用JSP技术和JavaScript实现一个简单的级联菜单功能。这种方法不仅适用于简单的省份-城市选择器,还可以扩展到更复杂的多级选择器中。开发者可以根据具体需求调整和优化实现细节,...

    javascript实现级联菜单

    javascript实现省市级联菜单的效果

    JS级联菜单

    在JavaScript(JS)中,级联菜单是一种常见的交互设计元素,常见于网站的导航栏,用于展示多级分类。级联菜单允许用户在一个下拉菜单中选择多个层次的选项,通常伴随着点击事件来展开或收起子菜单。下面将详细介绍...

    级联菜单的实现

    在Web开发中,级联菜单通常用HTML、CSS和JavaScript实现。HTML负责定义菜单结构,CSS控制样式,JavaScript处理交互逻辑。例如,可以使用`&lt;ul&gt;`和`&lt;li&gt;`标签创建一个多级的无序列表,然后通过CSS的`display`属性控制...

    js级联菜单实现全国省市下拉菜单

    在网页设计中,级联菜单(Cascading Menu)是一种常见的交互元素,它通常用于组织大量分类信息,如本例中的全国省市结构。利用JavaScript(JS)可以方便地实现这种功能,提供用户友好的交互体验。下面将详细介绍如何...

    级联菜单修改 js css

    在“菜单 menu JavaScript css js div 下拉级联菜单”这个话题中,`div` 是HTML中的一个常用元素,常用来作为容器来组织页面内容。在这个场景中,`div`被用作构建菜单结构的基本单元,每个菜单项可能是一个`div`元素...

    JS实现级联菜单 三级级联

    用js实现三级级联,('s1','s2')"&gt; 请选择&lt;/option&gt; &lt;option value="A" &gt;A&lt;/option&gt; &lt;option value="B"&gt;B&lt;/option&gt; ('s2','s3')"&gt; 请选择&lt;/option&gt; &lt;select id="s3"&gt; 请选择&lt;/option&gt; &lt;/select&gt;

    异步级联菜单脚本示例

    JavaScript是实现异步级联菜单的主要编程语言,负责处理用户交互、DOM(文档对象模型)操作以及AJAX请求的发送和响应处理。在"AjaxMultiMenu.html"页面中,JavaScript代码会监听用户的点击事件,当用户选择一个菜单...

    二级级联菜单

    在本例中,我们讨论的是通过JavaScript实现的二级级联菜单,即在一个文本框的选择会影响到另一个文本框的可选项。 一、级联菜单的基本概念 级联菜单由多个层次的菜单项构成,通常表现为一个菜单项展开后显示下一级...

    用AJAX实现的级联菜单

    AJAX(Asynchronous JavaScript and XML)技术可以有效地实现级联菜单的动态加载和交互,无需刷新整个页面即可获取并显示数据。 **AJAX** 是一种在不重新加载整个网页的情况下,与服务器交换数据并更新部分网页的...

    动态树形结构的级联菜单

    常见的JavaScript库如jQuery、Vue.js、React.js等都有相应的组件或插件支持级联菜单的创建。 5. **数据绑定**:级联菜单的数据通常来自服务器,可以通过Ajax或Fetch API进行异步获取。数据结构一般包含节点ID、父...

    Ajax 实现级联菜单

    在本项目中,Ajax被用来实现级联菜单的效果,即一个下拉菜单的选择会影响另一个下拉菜单的内容,这种交互方式常见于数据层级关系丰富的表单中。下面将详细介绍Ajax实现级联菜单的相关知识点。 1. **异步通信**: ...

    注册验证及javascript实现级联菜单

    本教程将探讨如何使用JavaScript实现注册验证以及级联菜单的功能,这些技术对于创建一个高效且用户体验良好的网页至关重要。 首先,让我们详细了解一下注册验证。注册验证是为了确保用户在创建账户时输入的信息是...

    三级级联菜单(JS+HTML)

    标题中的“三级级联菜单(JS+HTML)”指的是在网页设计中使用JavaScript和HTML实现的具有三级结构的下拉菜单。这种菜单允许用户通过点击主菜单项来展开子菜单,进一步点击子菜单项可以展开更深层次的选项,提供了一种...

Global site tag (gtag.js) - Google Analytics