<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
/**
new option(descript,value);
Option是select中的选择项,descript是页面中看到的描述,而value是这一项的值,比如
<option value="这里是value">这里是descript</option>
new option(); 一般用在动态生成选择项目
**/
var m_list=[[1,2,3,45,666,77]];
function change()
{
var e = document.myform.elements["jx"];
e.innerHTML = "";
with(e)//look here,with 用于简化代码;表示在with语句中的任何表达式的所属对象或者是类都由with后紧跟的变量所代表
{
options[0] = new Option("选择机型", "");//e元素下的options
var d = m_list[0];
var idx = 0;
for(var i in d)
{
if(d[i].length < 1){
continue;
}
var y = "--" +d[i] + "--";
options[idx++] = new Option(y, d[i]);
}
}
}
function showValue(sel){
if(sel){
with(sel){//
alert(value);//select元素的value,相当于document.getElementById('jx').value;
}
}
}
</script>
</HEAD>
<BODY>
<form name='myform'>
<select name="jx" onchange='javascript:showValue(this)'>------------</select>
</br>
<input type='button' value='Add Select Option' onclick='javascript:change();'>
</form>
</BODY>
</HTML>
分享到:
相关推荐
在《Learn JavaScript with p5.js》这本书中,作者Engin Arslan带领读者从零开始学习如何使用JavaScript和p5.js库创建计算机图形。本书面向初学者,特别是那些对视觉学习感兴趣的人士。 **JavaScript**是一种广泛...
Back-End Interaction with Ajax and Node.js Data Validation Techniques Modern JavaScript Case Study: A Dynamic Gallery Using Third-Party JavaScript Appendix A: Debugging JavaScript Book Details ...
Back-End Interaction with Ajax and Node.js Chapter 9. Data Validation Techniques Chapter 10. Modern JavaScript Case Study: A Dynamic Gallery Chapter 11. Using Third-Party JavaScript Appendix A. ...
using JavaScript and p5.js and secondarily in creating visuals. The main focus is to teach you how to program so that you can choose to pursue whatever field that you would like with your newly ...
Beginning Javascript with DOM Scripting and Ajax (From Novice to Professional) Javascript DOM和Ajax编程,从新手到专家!! 推荐!!!
Beginning JavaScript with DOM Scripting and Ajax(2nd) 英文epub 第2版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Beginning JavaScript with DOM Scripting and Ajax, 2nd Edition: This book will teach you about JavaScript and how to use it in a practical manner. After you read it, you’ll be able to Understand ...
Learn JavaScript with p5.js Coding for Visual Learners 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
Learn JavaScript with p5.js Coding for Visual Learners 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或...
Learning PHP, MySQL & JavaScript With jQuery, CSS & HTML5(5th) 英文epub 第5版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
Pixel Maker App using JavaScript with Source Code
Memory Game Using HTML, CSS and JavaScript with Source Code
Beginning JavaScript with DOM Scripting and Ajax(2nd) 英文无水印pdf 第2版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源...
JavaScript Applications with Node.js, React, React Native and MongoDB: Design, code, test, deploy and manage in Amazon AWS By 作者: Eric Bush ISBN-10 书号: 0997196661 ISBN-13 书号: 9780997196665 出版...
Learn how to program JavaScript while creating interactive audio applications with JavaScript for Sound Artists: Learn to Code With the Web Audio API! William Turner and Steve Leonard showcase the ...
Chapter 2 Getting Started With Node.Js Chapter 3 Acquisition, Storage, And Retrieval Chapter 4 Working With Unusual Data Chapter 5 Exploratory Coding Chapter 6 Clean And Prepare Chapter 7 Dealing With...
JavaScript中的`with`关键字是一个颇具争议的特性,它允许开发者在一个特定的作用域内访问对象的属性,以此简化代码。然而,尽管它提供了便利,但通常并不推荐使用,因为`with`带来了一些潜在的问题和不利影响。 一...