javascript在选择下拉值后,在Safari中不会触发更改事件 [英] javascript On change event is not firing in Safari after selecting the dropdown value

查看:113
本文介绍了javascript在选择下拉值后,在Safari中不会触发更改事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面中有一个下拉列表。每当选择一个用户选项时,它应该打开一个带有所选索引URL的新窗口。以下代码适用于除safari之外的所有浏览器。

I have a dropdown in my page. Whenever a user is selected the option it should open a new window with the selected index url. the below code is working in all browsers except safari.

任何想法都可以解决这个问题..?

Any idea to solve this issue..?

<form>
    <select class="searchboxproduct" style="width: 243px;" name="URL"  onchange="window.open(this.form.URL.options[this.form.URL.selectedIndex].value)">
        <option value="">select</option>
        <option value="www.gmail.com/">Gmail</option>
        <option value="www.google.com">google</option>
    </select>
</form>


推荐答案

我已经尝试过你的代码了,它没有也可以打开一个新的标签。

但是当我将safari设置设置为 NOT阻止弹出窗口时,它就有效了!

因此我不知道认为这是你的代码问题。

I've tried your code, it didn't open a new tab, either.
But when I set the safari settings to NOT block pop-up windows, it worked !
Therefore I don't think it's your code's problem.

更大尺寸的图片是这里

这篇关于javascript在选择下拉值后,在Safari中不会触发更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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