code的后退按钮 [英] code for back button

查看:152
本文介绍了code的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有一个php code,我想创建一个回HREF让我回到我原来所在之处。下面是我有:

 <输入类型=提交< A HREF =#的onclick =history.back();>中后退< / A>     < HTML和GT;
     < HEAD>< /头>
     <身体GT;     < PHP
     //获取表单中的选择
     $天= $ _GET ['天'];
     //检查值,并选择适当的项目
      如果($天== 1){
      $特殊='鸡蚝油';
         }
      ELSEIF($ == 2天){
      $特殊='法式洋葱汤';
       }
      ELSEIF($ == 3天){
       $特殊='猪排用土豆泥和蔬菜沙拉';
        }
      其他{
      $特殊=鱼和薯条;
      }
      ?>      < H2>今天的特殊之处在于:LT; / H>
       <?PHP的echo $特殊的; ?>
       <输入类型=提交< A HREF =#的onclick =history.back();>中后退< / A>
       < /身体GT;
       < / HTML>

请帮忙。在此先感谢!


解决方案

 <按钮的onclick =history.go(-1);>返回< /按钮>

I have a php code here and I would like to create a "back" href to get me back to where I was before. Here's what I have:

<input type="submit" <a href="#" onclick="history.back();">"Back"</a>

     <html>
     <head></head>
     <body>

     <?php
     // get form selection
     $day = $_GET['day'];
     // check value and select appropriate item
      if ($day == 1) {
      $special = 'Chicken in oyster sauce';
         }
      elseif ($day == 2) {
      $special = 'French onion soup';
       }
      elseif ($day == 3) {
       $special = 'Pork chops with mashed potatoes and green salad';
        }
      else {
      $special = 'Fish and chips';
      }
      ?>

      <h2>Today's special is:</h2>
       <?php echo $special; ?>
       <input type="submit" <a href="#" onclick="history.back();">"Back"</a>
       </body>
       </html> 

Please help. Thanks in advance!

解决方案

<button onclick="history.go(-1);">Back </button>

这篇关于code的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆