简体   繁体   English

Javascript - URL 基于下拉选择 - 如果所有下拉变量均为空白,则转到特定的 URL

[英]Javascript - URL based on Drop Down Selections - If all dropdowns variables are blank, then goto a specific URL

This is my code so far: http://jsfiddle.net/zY3xx/到目前为止,这是我的代码: http://jsfiddle.net/zY3xx/

I have a blank option in all 3 dropdowns, and I want to modify the existing Javascript so that it goes to a specific URL if all 3 dropdowns have the blank option selected.我在所有 3 个下拉菜单中都有一个空白选项,我想修改现有的 Javascript 以便它转到特定的 URL 如果所有 3 个下拉菜单都选择了空白选项。 The Variable is literally left empty, so it should be something along the lines of:变量实际上是空的,所以它应该是这样的:

if newURL = "" then goto "http://mycustomurl.com"

I'm just not sure how to implement that option in Javascript.我只是不确定如何在 Javascript 中实现该选项。

Does anyone know how?有谁知道怎么做?

Try this :试试这个

    if (newUrl.length === 0) {
        newUrl = 'http://google.com';
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM