iOS 7 onchange事件在iPad 3 + Mini中损坏//需要解决 [英] iOS 7 onchange event is broken in iPad 3+Mini // Need work around

查看:256
本文介绍了iOS 7 onchange事件在iPad 3 + Mini中损坏//需要解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请仅在运行ios 7的iPad上进行测试

似乎iOS 7不支持alert()和confirm()用于iPad上的onchange事件。奇怪的是,它适用于运行ios 7.0和桌面浏览器的iPhone 4,但不适用于ipad 3或ipad mini运行ios 7.0。它触发对话框,点击它会使按钮变暗(就像被点击),然后浏览器冻结。发生在iOS 7 iPad和iPad mini上运行的Safari和chrome。

It appears that iOS 7 doesn't support alert() and confirm() for onchange events on iPad. Strange thing is that it works on iPhone 4s running ios 7.0 and in desktop browser but not on ipad 3 or ipad mini running ios 7.0. It fires the dialog and when clicked it darkens the button (as if it was clicked) and then the browser freezes. Happens in both Safari and chrome running on iOS 7 iPad and iPad mini.

任何指针都将不胜感激。已经尝试过onblur和onkeypress没有成功: - /

Any pointers would be greatly appreciated. Already tried onblur and onkeypress with no success :-/

Options
<select id="iCard" onchange="alert('It worked.')">
    <option value="0" selected="selected">(none)</option>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
    <option value="4">Option 4</option>
</select>

可以在这里看到问题(确保在运行iOS 7的iPad上测试): http://jsfiddle.net/sethsanders/MvSxm/

Issue can be seen here (make sure to test it on iPad running iOS 7): http://jsfiddle.net/sethsanders/MvSxm/

推荐答案

解决方法请 http://jsfiddle.net/sethsanders/ZzkBd/

这是非常IE7需要一个setTimeout来处理卡住的事件处理程序

It is very IE7 to need a setTimeout to handle a stuck event handler

function SetCard(sel) {
   setTimeout(function() { alert('SetCard called successfully.');},10);
   document.getElementById("msg").innerHTML=sel.value + ":" + sel.options[sel.selectedIndex].text;
}

这篇关于iOS 7 onchange事件在iPad 3 + Mini中损坏//需要解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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