html <select> <option> 实现根据选择不同的option,调用不同的方法功能
2013-02-21 18:29
941 查看
<select id="select" data-role="none"> <option gid="1" value="1" selected>Take Photo</option> <option gid="0" value="0">Choose exist image</option> </select>
注:此法使用phonegap, ios
用jquery为select分别绑定change和blur两个函数,change用来监听选取的是哪个option,blur用来最后获取select的值,并实现根据点击不同的option调用不同的函数功能。
//take photo or choose an exist picture jQuery(document).ready(function() { jQuery("#select").change(function() { select_value = jQuery(this).val(); if (select_value == "1") { pictureSource = navigator.camera.PictureSourceType.CAMERA; } else { pictureSource = navigator.camera.PictureSourceType.PHOTOLIBRARY; } }); jQuery("#select").blur(function(){ getPhoto(pictureSource);//getPhoto根据不同的pictureSourc值,实现不同的功能 }); });
相关文章推荐
- 1#include<stdio.h> #include<string.h> int deng(char a[],ch、用函数实现登陆功能(三次机会),然后在主函数中根据调用后的结果判断 登陆成功与否。
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- HTML5调用手机摄像机、相册功能 <input>方法
- TreeList + <select />+Ajax实现按部门选择员工
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- 扩展方法IEnumerable<T>转换为IList<SelectListItem> ,提供@Html.DropDownList使用
- 操作TreeView:,选中左边树的节点,点击>>按钮 将选择的节点展现到右边的树中,同时将选择的节点从左边的树中移除。。点击<<实现同样的功能。。。。
- 关于JSP中单击任意标签弹出文件选择框(<input type="file"/>)的实现方法
- S动态添加与删除select中的Option对象 2009年09月23日 15:26 <html> <head> <meta http-equiv="Content-Type" content="t
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- 批量处理 Html img 标签,给 img 标签包裹一个 <a href="${url}"> 标签,用来实现“查看大图”的功能
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- 关于html中charset与<title>位置不同页面空白的问题及解决方法
- JS实现选择不同select标签option值的验证
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现
- Vue中使用Froala Editor时,外部方法调用html.insert()插入内容到光标最后停留位置功能实现