如何在页面重新加载时设置.click jquery变量?

时间:2009-05-07 14:18:56

标签: javascript jquery

在页面的过程中,我选择了一个相框来构建带有消光的图像 - 该部分有效。我想做什么:如果我决定我想要2个垫子,我将如何在页面重新加载时加载frame8,将matting设置为1 mat并将帧设置为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 var在这里设置了我点击的框架 -

$('#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>

1 个答案:

答案 0 :(得分:0)

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