Home  >  Article  >  php教程  >  PHP 和 AJAX XML 实例

PHP 和 AJAX XML 实例

WBOY
WBOYOriginal
2016-06-06 19:58:481146browse

HTML 表单 上面的例子包含了一张简单的 HTML 表单,以及指向 JavaScript 的链接: htmlheadscript src=selectcd.js/script/headbodyform Select a CD:select name=cds onchange=showCD(this.value)option value=Bob DylanBob Dylan/optionoption value=Bee G

HTML 表单

上面的例子包含了一张简单的 HTML 表单,以及指向 JavaScript 的链接:


<script src="selectcd.js"></script>




Select a CD:

CD info will be listed here.

例子解释:

正如您看到的,它仅仅是一张简单的 HTML 表单,其中带有名为 "cds" 的下拉列表。

表单下面的段落包含了一个名为 "txtHint" 的 div。这个 div 用作从 web 服务器检索到的数据的占位符。

当用户选择数据时,会执行名为 "showCD" 的函数。这个函数的执行是由 "onchange" 事件触发的。

换句话说,每当用户改变了下拉列表中的值,就会调用 showCD 函数。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn