基于列表项的输入文本显示 [英] List item based display of input text

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

问题描述

我认为这是一个Javascript问题,我在ASP论坛中错误地发布了这个问题。


我正在创建一个官方用途的应用程序。员工可以使用此应用程序将物品用于官方用途。


我有一个清单,目前这个清单包含三个项目 -

1)墨盒,

2)软盘,

3)CD


注意:如果用户选择墨盒,则应显示打印机列表,

如果选择了软盘或CD,则应显示'目的''文本项。

还有更多,


我遇到了这个问题,即如何在选择墨盒时显示列表,然后在选择软盘或CD时如何显示目的文本项目。


用户有选择多个项目。如果选择了任何项目,则此项目将显示在另一个框中。所有选中的项目都显示在此框中。


我的问题只是如何基于列表项目显示输入文本。


谢谢并且问候,

Vikas

I think this is a Javascript question and i have posted this question in ASP forum my mistakenly.

I am creating an application for official use. This application will be used by employees to take items for official use.

I have a list, presently this list contains three items -
1) Cartridges,
2) Floppy,
3) CD

Note : If a user selects Cartridges then list of printer should display,
And if floppy or CD is selected, then ''purpose'' text item should display.
And many many more,

I am got entangled in this problem that how to display list when cartridge is selected and then how to display ''purpose'' text item when floppy or cd is selected.

User has choice to select more than one item. If any item is selected, then this item is displayed in a another box. All the selected items are displayed in this box.

My problem is only how to do list item based display of input text.

Thanks and regards,
Vikas

推荐答案

您好Vikas我给出了一个匹配您的标准的示例,您只需编写自己的代码。 />

[HTML]< html>

< head>

< script type =" text / javascript">

函数doThis()

{

var sel = document.getElementById(''mySelect1'')。selectedIndex;

// alert(sel);

if(sel == 0)

document.getElementById(''myDiv'')。innerHTML =你选择了一个Apple;

else if(sel == 1)

document.getElementById(''myDiv'')。innerHTML ="你选择了如果(sel == 2)

document.getElementById(''myDiv'')。innerHTML ="你选择了一个Mango"; <橙色" ;;

br />
else if(sel == 3)

document.getElementById(''myDiv'')。innerHTML ="你选择了一个Grape" ;;

else

document.getElementById(''myDiv'')。innerHTML ="你选择了一个Pine;



}

< / script>

< / head>

< table>

< tr>

< td>

< select id =" mySelect1"大小= QUOT; 10" onclick =" doThis()">

< option> Apple< / option>

< option> Orange< / option>

< option> Mango< / option>

< option> Grape< / option>

< option> Pine< / option>

< / select>

< / td>

< td>

< div id =" myDiv" ;>

< / div>

< / td>

< / tr>

< / table>

< / html> [/ HTML]


如果有任何疑问,我会尽力帮助你


问候

Ramanan Kalirajan
Hi Vikas I give u a example which matches ur criteria from that u just write ur own code.

[HTML]<html>
<head>
<script type="text/javascript">
function doThis()
{
var sel = document.getElementById(''mySelect1'').selectedIndex ;
// alert(sel);
if(sel==0)
document.getElementById(''myDiv'').innerHTML="You selected an Apple";
else if(sel==1)
document.getElementById(''myDiv'').innerHTML="You selected an Orange";
else if(sel==2)
document.getElementById(''myDiv'').innerHTML="You selected an Mango";
else if(sel==3)
document.getElementById(''myDiv'').innerHTML="You selected an Grape";
else
document.getElementById(''myDiv'').innerHTML="You selected an Pine";


}
</script>
</head>
<table>
<tr>
<td>
<select id="mySelect1" size="10" onclick="doThis()">
<option>Apple</option>
<option>Orange</option>
<option>Mango</option>
<option>Grape</option>
<option>Pine</option>
</select>
</td>
<td>
<div id="myDiv">
</div>
</td>
</tr>
</table>
</html>[/HTML]

If any doubts post it back I will try to help u out

Regards
Ramanan Kalirajan


感谢您的快速回复。


我认为这个例子最适合我。我会尽我所能


好​​的再次感谢。


Vikas
Thanks for very quick response.

I think this example will suit me best. I shall try my best

OK thanks again.

Vikas



感谢您的快速回复。


我认为这个例子最适合我。我会尽我所能


好​​的再次感谢。


Vikas
Thanks for very quick response.

I think this example will suit me best. I shall try my best

OK thanks again.

Vikas



好。没有问题。祝一切顺利。如果你打了起来。请将其发布到论坛。我会尽力帮助你。


问候

Ramanan Kalirajan

Ok. No Probs. All the best. If u struck up. pls post it to the forum. I will try to help u out.

Regards
Ramanan Kalirajan


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

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