Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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 在Mozilla firefox中不工作,在chrome$(';输入[数据类型=";choise";]';)中工作正常。更改(函数()_Javascript_Php_Jquery - Fatal编程技术网

Javascript 在Mozilla firefox中不工作,在chrome$(';输入[数据类型=";choise";]';)中工作正常。更改(函数()

Javascript 在Mozilla firefox中不工作,在chrome$(';输入[数据类型=";choise";]';)中工作正常。更改(函数(),javascript,php,jquery,Javascript,Php,Jquery,我正在与在线测试门户合作,开发它在chrome上可以正常工作的版本,但问题是它在mozill上无法正常工作。我的代码如下,它在chrome上可以正常工作,但在mozilla firefox上无法正常工作。请给我一个替代方案或解决方案 输入[data type=“choise”]不起作用 <script> ( document ).ready(function() { $('input[data-type=

我正在与在线测试门户合作,开发它在chrome上可以正常工作的版本,但问题是它在mozill上无法正常工作。我的代码如下,它在chrome上可以正常工作,但在mozilla firefox上无法正常工作。请给我一个替代方案或解决方案

输入[data type=“choise”]不起作用

        <script>
( document ).ready(function() {
                                $('input[data-type="choise"]').change(function() {
              var Question = $(this).attr('name');
              var Checked = $(this).attr('value');
                 y++;
              if(Checked=="0"){

              }else{
                  x++;


              }
              $('#score').replaceWith("<span id='score'><input type='hidden' name='score' id='score' value='"+ x +"' /> <input type='hidden' name='totalquestions' id='totalquestions' value='"+ y +"' /></span>");
                alert('Selected Choise for ' + Question + ' is ' + Checked+ 'and score is'+ x);

            });
            });
            </script>

        <div class="time">
        <label> Remaining Time </label> <span id="timer"></span>
        </div>
        <?php 
         include('connection.php');
        $test=$_SESSION["testnum"];
        $query=mysql_query("select * from questions where Testno='$test' order by Id ASC"); 
        if($query==true){  ?>
        <form id="scoretarget" name="formsubmit" action="congrasulations.php" method="POST">
        <span id="score"><input type="hidden" name="score" id="score" value="" />
        <input type='hidden' name='totalquestions' id='totalquestions' value="" />
        </span>
        <hr class="hr">
        <?php $id=1;
        While($row=mysql_fetch_array($query)){ ?>
            <?php 
            $questionnum=$row['Questionno'];
            $question=$row['Question'];
            $ans=$row['Answer'];
            ?>
             <div class="question">
            <div class="row">
            <div class="col-md-1">

            <label class="control-label form-inline">
            <?php echo $questionnum?>
            </label>
            </div>
            <div class="col-md-11 quest-left">
            <div class="form-group">
            <label class="control-label form-inline">
            <?php echo $question;?>
            </label>

            </div>
            <fieldset>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option A"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option1'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option B"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option2'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option C"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option3'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option D"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option4'];?></span><br>
             </fieldset>
          </div>

          </div>
            </div><br>
          <?php ++$id;} ?>


          <input type="submit" name="proceed" value="proceed" class="btn btn-info pull-right">


          </form>

        <?php  } else{?>

        <div class="question">
            <div class="row">

        <div class="col-md-12">
        <h4 style="text-align:center; color:red;"> Question Paper is not updated  </h4>
        </div></div></div>
        <?php }

        ?>
              </div>

(文档).就绪(函数(){
$('input[data type=“choise”]”)。更改(函数(){
var Question=$(this.attr('name');
var Checked=$(this.attr('value');
y++;
如果(选中==“0”){
}否则{
x++;
}
$(“#分数”)。替换为(“”);
警报(“为“+问题+”选择的选项为“+选中+”,分数为“+x”);
});
});
剩余时间

您将数据类型作为必须选择的选项。Duh拼写错误。

您将数据类型作为必须选择的选项。Duh拼写错误。


<script>
( document ).ready(function() {
                                $('input[data-type="choise"]').click(function() {
              var Question = $(this).attr('name');
              var Checked = $(this).attr('value');
                 y++;
              if(Checked=="0"){

              }else{
                  x++;


              }
              $('#score').replaceWith("<span id='score'><input type='hidden' name='score' id='score' value='"+ x +"' /> <input type='hidden' name='totalquestions' id='totalquestions' value='"+ y +"' /></span>");
                alert('Selected Choise for ' + Question + ' is ' + Checked+ 'and score is'+ x);

            });
            });
            </script>

        <div class="time">
        <label> Remaining Time </label> <span id="timer"></span>
        </div>
        <?php 
         include('connection.php');
        $test=$_SESSION["testnum"];
        $query=mysql_query("select * from questions where Testno='$test' order by Id ASC"); 
        if($query==true){  ?>
        <form id="scoretarget" name="formsubmit" action="congrasulations.php" method="POST">
        <span id="score"><input type="hidden" name="score" id="score" value="" />
        <input type='hidden' name='totalquestions' id='totalquestions' value="" />
        </span>
        <hr class="hr">
        <?php $id=1;
        While($row=mysql_fetch_array($query)){ ?>
            <?php 
            $questionnum=$row['Questionno'];
            $question=$row['Question'];
            $ans=$row['Answer'];
            ?>
             <div class="question">
            <div class="row">
            <div class="col-md-1">

            <label class="control-label form-inline">
            <?php echo $questionnum?>
            </label>
            </div>
            <div class="col-md-11 quest-left">
            <div class="form-group">
            <label class="control-label form-inline">
            <?php echo $question;?>
            </label>

            </div>
            <fieldset>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option A"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option1'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option B"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option2'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option C"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option3'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option D"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option4'];?></span><br>
             </fieldset>
          </div>

          </div>
            </div><br>
          <?php ++$id;} ?>


          <input type="submit" name="proceed" value="proceed" class="btn btn-info pull-right">


          </form>

        <?php  } else{?>

        <div class="question">
            <div class="row">

        <div class="col-md-12">
        <h4 style="text-align:center; color:red;"> Question Paper is not updated  </h4>
        </div></div></div>
        <?php }

        ?>
              </div>
(文档).就绪(函数(){ $('input[data type=“choise”]”)。单击(函数(){ var Question=$(this.attr('name'); var Checked=$(this.attr('value'); y++; 如果(选中==“0”){ }否则{ x++; } $(“#分数”)。替换为(“”); 警报(“为“+问题+”选择的选项为“+选中+”,分数为“+x”); }); }); 剩余时间

(文档).就绪(函数(){
$('input[data type=“choise”]”)。单击(函数(){
var Question=$(this.attr('name');
var Checked=$(this.attr('value');
y++;
如果(选中==“0”){
}否则{
x++;
}
$(“#分数”)。替换为(“”);
警报(“为“+问题+”选择的选项为“+选中+”,分数为“+x”);
});
});
剩余时间

请使用此$(“input[data type=choise]”)您在这里有一个打字错误
(文档)
,但我想这只是个问题。现在,您必须定义“not working”?控制台中的错误?如何调试它?无论如何,您的选择器肯定在FF上工作,所以我不确定是什么让您认为这是您的问题?!请使用此$(“input[data type=choise]”)这里有一个打字错误
(文档)
但我想这只是个问题。现在,您必须定义“不工作”?控制台中的错误?您如何调试它?无论如何,您的选择器肯定会在FF上工作,所以我不确定是什么让您认为这是您的问题?!这是使用定义的未预定义的内容拼写,而使用定义的未预定义的内容拼写,$('input[data type=“choise”]”。将(函数()更改为$('input[data type=“choise”]”)。单击(函数()可以使用chrome和firefoxChange$('input[data type=“choise”]”)。将(函数()更改为$('input[data type=“choise”])。单击(函数()可以使用chrome和firefox