我是jQuery的新手。我希望使用jQuery将值从一个页面传递到另一个页面。我还有传递这个值的javascript代码。但是我想使用jQuery做同样的事情。
我的php和Javascript代码如下所示
PHP代码:
<?php
for ($i=1; $i<count($array)+1; $i++) {
?>
<tr>
<td><?php print_s($array[$i]['open_date']); ?></td>
<td style="width: 120px" ><?php print_s($array[$i]['group']); ?></td>
<td style="width: 150px" ><?php print_s($array[$i]['division']); ?></td>
<td style="width: 30px" ><?php print_s($array[$i]['control_no_parent']); ?>
<input type="hidden" name="group[<?php print_s($i); ?>]" id="group[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['group']); ?>" />
<input type="hidden" name="division[<?php print_s($i); ?>]" id="division[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['division']); ?>" />
<input type="hidden" name="control_no_parent[<?php print_s($i); ?>]" id="control_no_parent[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['control_no_parent']); ?>" />
</td>
<td>
<?php print_s($array[$i]['control_no_child']); ?>
<input type="hidden" name="control_no_child[<?php print_s($i); ?>]" id="control_no_child[<?php print_s($i); ?>]" value="<?php print_s($array[$i]['control_no_child']); ?>" />
</td>
<td><?php print_s($array[$i]['title']); ?></td>
<td><input type="submit" name="disp_btn[<?php print_s($i); ?>]" class="w50" value="表 示" onClick = "tekeOver(<?php print_s($i); ?>)"/></td>
</tr>
<?php
}
?>Javascript代码:
function tekeOver(RowNo) {
document.getElementById('RowNo').value = RowNo
document.getElementById('group').value = document.getElementById('group[' + RowNo + ']').value
document.getElementById('division').value = document.getElementById('division[' + RowNo + ']').value
document.getElementById('control_no_parent').value = document.getElementById('control_no_parent[' + RowNo + ']').value
document.getElementById('control_no_child').value = document.getElementById('control_no_child[' + RowNo + ']').value
}发布于 2017-02-15 02:51:11
在我看来,我们有一些方法。首先,如果我们不关心浏览器的支持,我们可以使用cookie。第一页:
$.cookie('the_cookie', 'the_value');另一页:
$.cookie('the_cookie');当然,我们需要jquery插件jquery.cookie.js,更重要的是,我们可以在url中传递价值。
https://stackoverflow.com/questions/42239532
复制相似问题