sessionStorage是1/2工作

时间:2017-02-02 08:06:25

标签: sessionstorage

pag1.php

 <div id="guest_name"></div>
<?
//Some code
echo '<script>';
echo 'var guest_name = ' . json_encode($guest_name) . ';';
echo '</script>';
echo "<a href=main.php>Enter</a>";
?>
<script>    
//This works great
   $("#guest_name").text(sessionStorage.getItem("guest_name"));    
</script>

当我点击并转到main.php时,它停止工作!!

<div id="guest_name"></div><!--Nothing is shown this div here -->
<script>
$("#guest_name").text(sessionStorage.getItem("guest_name"));  //Does not work!!
</script>

main.php未加载到新窗口或新标签中!谢谢

0 个答案:

没有答案