douyun1546 2015-06-17 22:33
浏览 35

自定义js的wordpress弹出窗体

I am using a wordpress plugin - ICEGRAM to add custom JS in the code. I am still beginning and would really appreciate the help.

Basically I am putting this inline on the plugin page that accepts css, html and javadcript. I am not getting my alerts to proceed forward and there could be a million issues. Is there some protocol to run javascript through wordpress? should I be adding the script header in the php or something???

here is my inline code to run on the popup.....

link http://wolfsonwhites.com/wolfsonwhites/?campaign_preview_id=37

code for the popup with response;

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">// <![CDATA[


$(document).click(function(e){

    var elem = $(e.target).attr('class');

$('.btn-find').click(function(){

    var h1 = $('.select-box').val();
    var w1 = $('.weight').val();

    if(h1 == 0){

        alert('select a damn height');
        window.location.replace = "http://google.com";

    } else if(h1 == 1){

        alert('you picked less than 5ft');

        if(w1 < 100){

            alert('you are small');

            window.location.href = "http://google.com";

        } else if(w1 < 160){

            alert('you are not bad');

        } else if (w1 < 200){

            alert('less than 200!!');

        } else {

            alert('you are really big');
        }

    } else if(h1 == 2){

        alert('you picked less than 5ft4');

        if(w1 < 100){

            alert('you are small');

        } else if(w1 < 160){

            alert('you are not bad');

        } else if (w1 < 200){

            alert('less than 200!!');

        } else {

            alert('you are really big');
        }

    } else if(h1 == 3){

        alert('you picked less than 5ft8');

        if(w1 < 100){

            alert('you are small');

        } else if(w1 < 160){

            alert('you are not bad');

        } else if (w1 < 200){

            alert('less than 200!!');

        } else {

            alert('you are really big');
        }

    } else {

        alert('over 5ft9');

        if(w1 < 100){

            alert('you are small');

        } else if(w1 < 160){

            alert('you are not bad');

        } else if (w1 < 200){

            alert('less than 200!!');

        } else {

            alert('you are really big');
        }

    }

});

// ]]></script>
&nbsp;

&nbsp;
<div>
<div>

Select a Height:
<select class="select-box" name="Height">
<option value="0">Height...</option>
<option value="1">Less than 5ft</option>
<option value="2">5'0" - 5'2"</option>
<option value="3">5'3" - 5'5"</option>
<option value="4">5'6" - 5'8"</option>
<option value="5">5'9" - 5'11"</option>
<option value="6">6'0" - 6'2"</option>
<option value="7">6'3" - 6'5"</option>
</select>
<div style="height: 20px;"></div>
Enter your Weight:
<input class="weight" type="text" />
<div style="height: 20px;"></div>
Choose your Body Type:
<div class="your-size"></div>
<input class="btn-find" type="submit" value="Find" />
<div style="height: 20px;"></div>
</div>
</div>

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 MATLAB中streamslice问题
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序