Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript internet explorer无法识别脚本标记中的jquery_Javascript_Jquery_Html - Fatal编程技术网

Javascript internet explorer无法识别脚本标记中的jquery

Javascript internet explorer无法识别脚本标记中的jquery,javascript,jquery,html,Javascript,Jquery,Html,这在FF和Chrome中都有效,但在IE中没有点击操作 这是相关的javascript,在创建条目后调用 <script> $(".reserveAPickupAppointmentRoommateAppointment").click (function() { if ($(this).hasClass("confirm")) { } else { $("img").remove(".confirmAppointment");

这在FF和Chrome中都有效,但在IE中没有点击操作

这是相关的javascript,在创建条目后调用

<script>
$(".reserveAPickupAppointmentRoommateAppointment").click (function() {
    if ($(this).hasClass("confirm")) {
    }
    else {
        $("img").remove(".confirmAppointment");
        $(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
        $(this).addClass("confirm");
        $(this).append("<img src=images/confirmAppointment.png class=confirmAppointment id=roommateAppointment>");
        var entry = this;
        $(".confirmAppointment").click (function() {
            $(".confirmAppointment").unbind("click");
            var location = $(".reserveAPickupAppointmentLocation", entry).text();

            alert (location);
        });

    }
  });
</script>

$(“.reserveAPickupAppointmentRoommateAppointment”)。单击(函数(){
if($(this).hasClass(“确认”)){
}
否则{
$(“img”)。删除(“.confirmappoints”);
$(“.reserveAPickupAppointmentRoommateAppointment”).removeClass(“确认”);
$(此).addClass(“确认”);
$(此)。追加(“”);
var分录=此;
$(“.confirmappoints”)。单击(函数(){
美元(“.confirmappoints”)。取消绑定(“单击”);
变量位置=$(“.reserveAPickupAppointmentLocation”,条目).text();
警报(位置);
});
}
});
相关php/html…jquery在脚本标记中立即遵循这一点

echo '<table>';
while ($row = mysql_fetch_array($result)) { 

echo
'<tbody class = "reserveAPickupAppointmentRoommateAppointment">
    <tr>
            <td>'
                .$row["name"].
            '</td>
            <td>
                <span class = "reserveAPickupAppointmentlocation">'
                    .$row["location"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentSublocation">'
                    .$row["subLocation"].
                '</span>
            </td>
        </tr>
        <tr>
            <td>
                <span class = "reserveAPickupAppointmentStartTime">'
                .$row["startTime"].
            '</span>    - 
            <span class = "reserveAPickupAppointmentEndTime">'
            .$row["endTime"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentDate">'
                .$row["date"].
                '</span>
            </td>
        </tr>
    </tbody>';
}

echo '</table>
echo';
而($row=mysql\u fetch\u数组($result)){
回声
'
'
.$行[“名称”]。
'
'
.$行[“位置”]。
'
'
.$行[“子位置”]。
'
'
.$row[“开始时间”]。
'    - 
'
.$行[“结束时间”]。
'
'
.$行[“日期”]。
'
';
}
回声'
带警报的JQUERY

 $(".reserveAPickupAppointmentRoommateAppointment").click (function() {
    if ($(this).hasClass("confirm")) {
    }
    else {
        $("img").remove(".confirmAppointment");
        alert ("TEST1");
        $(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
        alert ("TEST2");
        $(this).addClass("confirm");
        alert ("TEST3");
        $(this).append("<img src=\'images/confirmAppointment.png\' class=\'confirmAppointment\' id=\'roommateAppointment\'>");
        alert ("TEST4");
        var entry = this;
        alert ("TEST5");
        $(".confirmAppointment").click (function() {
            $(".confirmAppointment").unbind("click");
            var location = $(".reserveAPickupAppointmentLocation", entry).text();

            alert (location);
        });

    }
   });
$(“.reserveAPickupAppointmentRoommateAppointment”)。单击(函数(){
if($(this).hasClass(“确认”)){
}
否则{
$(“img”)。删除(“.confirmappoints”);
警报(“测试1”);
$(“.reserveAPickupAppointmentRoommateAppointment”).removeClass(“确认”);
警报(“测试2”);
$(此).addClass(“确认”);
警报(“测试3”);
$(此)。追加(“”);
警报(“测试4”);
var分录=此;
警报(“测试5”);
$(“.confirmappoints”)。单击(函数(){
美元(“.confirmappoints”)。取消绑定(“单击”);
变量位置=$(“.reserveAPickupAppointmentLocation”,条目).text();
警报(位置);
});
}
});

IE可能对脚本标记有点挑剔。尝试:

<script type="text/javascript">

IE可能对脚本标记有点挑剔。尝试:

<script type="text/javascript">

我曾多次面对这种问题, 可能的解决办法

->视源

  • 检查,如果有任何错误的html语法,在我的情况下,我搞砸了 使用结束标记,例如检查标记或其他语法检查
  • 最好是检查html,你会得到更多的想法
  • 在上面的代码中,我想您需要将它们放在
    $(文档)上。准备好了吗

如果您没有得到解决,让我看看您的viewsource,

我曾多次遇到过此类问题, 可能的解决办法

->视源

  • 检查,如果有任何错误的html语法,在我的情况下,我搞砸了 使用结束标记,例如检查标记或其他语法检查
  • 最好是检查html,你会得到更多的想法
  • 在上面的代码中,我想您需要将它们放在
    $(文档)上。准备好了吗

如果您没有得到解决方案,请将您的viewsource告诉我,

您正试图将图像附加到tbody。我认为这是一个无效的html,因此不能在IE中工作。您必须将图像附加到td而不是tbody。请尝试以下代码:

<script type="text/javascript">
$(".reserveAPickupAppointmentRoommateAppointment").click (function() {
    if ($(this).hasClass("confirm")) {
    }
    else {
        $("img").remove(".confirmAppointment");
        $(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
        $(this).addClass("confirm");
        $(this).find('.confirm_button').append("<img src=\'images/confirmAppointment.png\' class=\'confirmAppointment\' id=\'roommateAppointment\'>");
        var entry = this;
        $(".confirmAppointment").click (function() {
            $(".confirmAppointment").unbind("click");
            var location = $(".reserveAPickupAppointmentLocation", entry).text();

            alert (location);
        });

    }
  });
</script>

echo '<table>';
while ($row = mysql_fetch_array($result)) { 

echo
'<tbody class = "reserveAPickupAppointmentRoommateAppointment">
    <tr>
            <td>'
                .$row["name"].
            '</td>
            <td>
                <span class = "reserveAPickupAppointmentlocation">'
                    .$row["location"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentSublocation">'
                    .$row["subLocation"].
                '</span>
            </td>
        </tr>
        <tr>
            <td>
                <span class = "reserveAPickupAppointmentStartTime">'
                .$row["startTime"].
            '</span>    - 
            <span class = "reserveAPickupAppointmentEndTime">'
            .$row["endTime"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentDate">'
                .$row["date"].
                '</span>
            </td>
        </tr>
<tr><td class="confirm_button"></td></tr>
    </tbody>';
}

echo '</table>';

$(“.reserveAPickupAppointmentRoommateAppointment”)。单击(函数(){
if($(this).hasClass(“确认”)){
}
否则{
$(“img”)。删除(“.confirmappoints”);
$(“.reserveAPickupAppointmentRoommateAppointment”).removeClass(“确认”);
$(此).addClass(“确认”);
$(this).find('.confirm_按钮')。append(“”);
var分录=此;
$(“.confirmappoints”)。单击(函数(){
美元(“.confirmappoints”)。取消绑定(“单击”);
变量位置=$(“.reserveAPickupAppointmentLocation”,条目).text();
警报(位置);
});
}
});
回声';
而($row=mysql\u fetch\u数组($result)){
回声
'
'
.$行[“名称”]。
'
'
.$行[“位置”]。
'
'
.$行[“子位置”]。
'
'
.$row[“开始时间”]。
'    - 
'
.$行[“结束时间”]。
'
'
.$行[“日期”]。
'
';
}
回声';

您正试图将图像附加到tbody。我认为这是一个无效的html,因此不能在IE中工作。您必须将图像附加到td而不是tbody。请尝试以下代码:

<script type="text/javascript">
$(".reserveAPickupAppointmentRoommateAppointment").click (function() {
    if ($(this).hasClass("confirm")) {
    }
    else {
        $("img").remove(".confirmAppointment");
        $(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
        $(this).addClass("confirm");
        $(this).find('.confirm_button').append("<img src=\'images/confirmAppointment.png\' class=\'confirmAppointment\' id=\'roommateAppointment\'>");
        var entry = this;
        $(".confirmAppointment").click (function() {
            $(".confirmAppointment").unbind("click");
            var location = $(".reserveAPickupAppointmentLocation", entry).text();

            alert (location);
        });

    }
  });
</script>

echo '<table>';
while ($row = mysql_fetch_array($result)) { 

echo
'<tbody class = "reserveAPickupAppointmentRoommateAppointment">
    <tr>
            <td>'
                .$row["name"].
            '</td>
            <td>
                <span class = "reserveAPickupAppointmentlocation">'
                    .$row["location"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentSublocation">'
                    .$row["subLocation"].
                '</span>
            </td>
        </tr>
        <tr>
            <td>
                <span class = "reserveAPickupAppointmentStartTime">'
                .$row["startTime"].
            '</span>    - 
            <span class = "reserveAPickupAppointmentEndTime">'
            .$row["endTime"].
                '</span>
            </td>
            <td>
                <span class = "reserveAPickupAppointmentDate">'
                .$row["date"].
                '</span>
            </td>
        </tr>
<tr><td class="confirm_button"></td></tr>
    </tbody>';
}

echo '</table>';

$(“.reserveAPickupAppointmentRoommateAppointment”)。单击(函数(){
if($(this).hasClass(“确认”)){
}
否则{
$(“img”)。删除(“.confirmappoints”);
$(“.reserveAPickupAppointmentRoommateAppointment”).removeClass(“确认”);
$(此).addClass(“确认”);
$(this).find('.confirm_按钮')。append(“”);
var分录=此;
$(“.confirmappoints”)。单击(函数(){
美元(“.confirmappoints”)。取消绑定(“单击”);
变量位置=$(“.reserveAPickupAppointmentLocation”,条目).text();
警报(位置);
});
}
});
回声';
而($row=mysql\u fetch\u数组($result)){
回声
'
'
.$行[“名称”]。
'
'
.$行[“位置”]。
'
'
.$行[“子位置