Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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 如何设置用于页面重新加载的.click jquery变量?_Javascript_Jquery - Fatal编程技术网

Javascript 如何设置用于页面重新加载的.click jquery变量?

Javascript 如何设置用于页面重新加载的.click jquery变量?,javascript,jquery,Javascript,Jquery,在一个页面的过程中,我选择了一个相框来框一个带有垫子的图像-这部分工作正常。我想做的是:假设垫子设置为1垫子,框架设置为Frame8如果我决定我想要2垫子,我如何在页面重新加载时加载Frame8。现在它将恢复为默认帧。页面中使用Jquery和php 在标题中: $('#mattes-radio-0').click(function() { window.location = 'index-custom.php?mattes=0'; }); $('#mattes-ra

在一个页面的过程中,我选择了一个相框来框一个带有垫子的图像-这部分工作正常。我想做的是:假设垫子设置为1垫子,框架设置为Frame8如果我决定我想要2垫子,我如何在页面重新加载时加载Frame8。现在它将恢复为默认帧。页面中使用Jquery和php

在标题中:

  $('#mattes-radio-0').click(function() {
    window.location = 'index-custom.php?mattes=0'; 
   });  
   $('#mattes-radio-1').click(function() {
    window.location = 'index-custom.php?mattes=1';
   });  
   $('#mattes-radio-2').click(function() {
    window.location = 'index-custom.php?mattes=2';
   });  
   $('#mattes-radio-3').click(function() {
    window.location = 'index-custom.php?mattes=3';
   });  
在正文中:
此处设置了我单击的框架的Javascript变量-

$('#frame$frame_id[$i]').click(function() {  
    $('#top-left-frame').html('<img src=\"$upper_left[$i]\" alt=\"\" />');  
    $('#top-mid-frame').css('background-image','url($upper_middle[$i])');   
    $('#top-right-frame').html('<img src=\"$upper_right[$i]\" alt=\"\" />');  
    $('#mid-left-frame').css('background-image','url($middle_left[$i])');   
    $('#mid-right-frame').css('background-image','url($middle_right[$i])');   
    $('#bottom-left-frame').html('<img src=\"$bottom_left[$i]\" alt=\"\" />');  
    $('#bottom-mid-frame').css('background-image','url($bottom_middle[$i])');   
    $('#bottom-right-frame').html('<img src=\"$bottom_right[$i]\" alt=\"\"   />');
    $('#frame-select').html('$prod_id');
    $('#pid-form').val('$frame_id[$i]');
    $('#oa_id-form').val('$prod_id');
    var frameState = $(this).attr('id');
    alert(frameState + ' was clicked.');


});  


<tr>
         <td>
No Mats:  <input type="radio" name="mattes-radio" align="middle"<?php if($_GET['mattes'] == 0){ echo 'checked="checked"';} ?> id="mattes-radio-0"> 
         </td>
         </tr>        
            <tr>
         <td>
            Single Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 1){ echo 'checked="checked"';} ?> id="mattes-radio-1"> 
         </td>
          </tr>  
         <tr>
<td>
            Double Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 2){ echo 'checked="checked"';} ?> id="mattes-radio-2"> 
         </td>
          </tr>  
 <tr>
         <td>
            Triple Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 3){ echo 'checked="checked"';} ?> id="mattes-radio-3"> 
         </td>

         </tr>
$('#frame$frame_id[$i]')。单击(function(){
$(“#左上框”).html(“”);
$(“#上中框”).css('background-image','url($i]);
$(“#右上框”).html(“”);
$(“#左中框”).css('background-image','url($middle#u left[$i]);
$(“#右中框”).css('background-image','url($middle#u right[$i]);
$(“#左下框”).html(“”);
$('bottom-mid-frame').css('background-image','url('bottom-mid[$i]);
$(“#右下框”).html(“”);
$('#frame select').html('$prod_id');
$('#pid form').val('$frame_id[$i]');
$('oa_id-form').val('prod_id');
var frameState=$(this.attr('id');
警报(已单击帧状态+);
});  
无垫子:id=“mattes-radio-1”>
双垫:id=“mattes-radio-3”>

设置cookie并在页面加载时读取它可能是最简单的选择。

我会在每次单击框架时设置/调整cookie吗。如果是这样的话,它是如何完成的,或者在哪里有一个好的网站来阅读它。没错。看一下获取/设置javascript中cookie的代码。