我们如何仅使用HTML和Javascript在移动应用程序中选择下拉值 [英] how can we select the drop down value in a mobile application using only HTML and Javascript

查看:62
本文介绍了我们如何仅使用HTML和Javascript在移动应用程序中选择下拉值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我正在开发使用HTML和javascript的移动应用程序....我在其中使用下拉列表....在javascript中,我传递了下拉列表的选定索引,以便将其选中...但是..因为我我正在使用适合移动设备的CSS ...在浏览器中,它会将Select标签和选项作为 ..,而不是select或option标签.... so,如果我使用
,则在javascript中

Hi...

I am developing a mobile application using HTML and javascript....where i am using a drop down.... in javascript i am passing the selected index of drop down so that it will be selected... but.. since i am using a CSS suitable for mobile... in browser it is taking the Select tag and option as .. and not as select or option tag....so in javascript if i use

document.getElementById('selectid').selectedindex



这没有被考虑,因为浏览器将选择标记用作跨度,所以...我如何使用js和相同的css选择我需要下拉的值.....

预先感谢您!!!



this is not getting considered as the browser is taking the select tag as span so... how can i select the value that i need the drop down using js... and same css.....

Thanking You in advance!!!

推荐答案

我一辈子都无法理解CSS与您的问题有什么关系.不过,

加载页面时,将在列表中选择一个随机项目.
更改列表中的项目时,将显示所选项目的值.

在body.onload函数的init1和init2之间切换,以通过值或索引选择项.

Can''t for the life of me fathom what css has to do with your problem. Nevertheless,

On loading the page, a random item is selected in the list.
When an item in the list is changed, the value of the selected item is displayed.

Change between init1 and init2 in the body.onload function to select an item by value or index.

<!DOCTYPE html>
<html>
<head>

<script>
function


(e){返回 函数 onList1Change() { var val,src,dst; src =
(e) {return document.getElementById(e);} function onList1Change() { var val, src, dst; src =


(" ); dst =
("list1"); dst =


这篇关于我们如何仅使用HTML和Javascript在移动应用程序中选择下拉值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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