显示所选项目 [英] Display the selected item

查看:58
本文介绍了显示所选项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!!!

我是Ranjan。


组合框的选定项目可以显示在同一页面上。

我的意思是当我点击一个组合框的项目时它会显示在页面上。


谢谢!!!

Hello !!!

I am Ranjan.

can the selected item of a combo box be displayed on the same page.
I mean when I just click the item of a combo box it will atonce displayed on the page.

Thanks !!!

推荐答案

使用javascript很容易实现。


将以下代码放在<选择>标签


onChange =" javascript :document.getElementById(''myId'').innerText = this.options [this.selectedIndex] .value;


当然,修改您希望放置内容的对象的ID。


例如.. 。


< select name =" whatever" ID = QUOT;凡是" onChange =" javascript :document.getElementById(''myId'').innerText = this.options [this.selectedIndex] .value;">

< ; option value =" whatever1"> Whatever1< / option>

< option value =" whatever1"> Whatever1< / option>

< option value =" whatever1"> Whatever1< / option>

< option value =" whatever1"> Whatever1< / option>

< option value = " whatever1"> Whatever1< / option>

< / select>


并且有一个图层,如div或span标签,出现在页面

< div id =" myId">< / div>
This is easy to accomplish with javascript.

Place the following code within your < select > tag

onChange="javascript:document.getElementById(''myId '').innerText=this.options[this.selectedIndex].value;"

Modify the Id of the object where you wish the content to be placed as necessary, of course.

For example...

<select name="whatever" id="whatever" onChange="javascript:document.getElementById(''myId '').innerText=this.options[this.selectedIndex].value;">
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
</select>

and have a layer, like a div or span tag, present on the page
<div id="myId"></div>



使用javascript很容易实现。


将以下代码放在<选择>标签


onChange =" javascript :document.getElementById(''myId'').innerText = this.options [this.selectedIndex] .value;


当然,修改您希望放置内容的对象的ID。


例如.. 。


< select name =" whatever" ID = QUOT;凡是" onChange =" javascript :document.getElementById(''myId'').innerText = this.options [this.selectedIndex] .value;">

< ; option value =" whatever1"> Whatever1< / option>

< option value =" whatever1"> Whatever1< / option>

< option value =" whatever1"> Whatever1< / option>

< option value =" whatever1"> Whatever1< / option>

< option value = " whatever1"> Whatever1< / option>

< / select>


并且有一个图层,如div或span标签,出现在页面

< div id =" myId">< / div>
This is easy to accomplish with javascript.

Place the following code within your < select > tag

onChange="javascript:document.getElementById(''myId '').innerText=this.options[this.selectedIndex].value;"

Modify the Id of the object where you wish the content to be placed as necessary, of course.

For example...

<select name="whatever" id="whatever" onChange="javascript:document.getElementById(''myId '').innerText=this.options[this.selectedIndex].value;">
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
<option value="whatever1">Whatever1</option>
</select>

and have a layer, like a div or span tag, present on the page
<div id="myId"></div>



你好!!!

你给我发了一个非常好的剧本。

但我很抱歉提到我实际上是在asp文件中尝试它。使用vbscript

所以我再次感到抱歉。

我仍​​然需要你的帮助。


Thankssssss !!!!

Hello !!!
You have sended me a very good script.
But I am sorry to mention that I actually trying it in an "asp file" using "vbscript"
So I am sorry again.
Still I need your help.

Thankssssss !!!!



你好!!!

你给我发了一个非常好的剧本。

但我很遗憾地提到我实际上是在asp文件中尝试它。使用vbscript

所以我很抱歉。

我仍​​然需要你的帮助。


谢谢!
Hello !!!
You have sended me a very good script.
But I am sorry to mention that I actually trying it in an "asp file" using "vbscript"
So I am sorry again.
Still I need your help.

Thanks!



Ranjan,

vbscript和javascript不是互斥的。 ASP脚本在服务器上运行,因此只在加载页面时才起作用,而标记建议您添加客户端脚本。最受支持的客户端脚本是javascript,他的示例适用于您的目的。


Jared

Ranjan,

vbscript and javascript are not mutually exclusive. ASP scripts are run on the server so only function when the page is loading, and mark is suggesting you add client-side scripting. The most well-supported client-side script is javascript and his example would work well for your purpose.

Jared


这篇关于显示所选项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆