加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

我可以用PHP做到这一点吗?

发布时间:2020-12-13 22:15:31 所属栏目:PHP教程 来源:网络整理
导读:考虑, html head titletxt with js eff/title /head body script type = "text/javascript" function transfer(which) { document.getElementById("temp_name").value = which; } /script form action="" method="post" name="frm1" label In put 1 /label i
考虑,

<html>
      <head>
          <title>txt with js eff</title>
      </head>

      <body>
          <script type = "text/javascript">
              function transfer(which) {
                  document.getElementById("temp_name").value = which;
              }
          </script>

          <form action="" method="post" name="frm1">
              <label> In put 1 </label>
              <input
                type="text"
                name="username"
                id = "username"
                onkeyup = "transfer(this.value)"><br/><br/>

              <label> In put 2 </label>
              <input
                type="text"
                name="temp_name"
                id = "temp_name">
          </form>
      </body>
  </html>

我需要使用PHP来做到这一点:

当用户将他/她的光标聚焦到下一个字段时,我需要将值从“In put 1”传递给“In put 2”.我可以使用JavaScript轻松完成,但我需要使用PHP.

有解决方案吗?

解决方法

你不用PHP做这种类型的东西,你用Javascript做. PHP仅在服务器上运行.您必须将此页面发回服务器,让PHP编写一个javascript块,一旦页面加载就会导致特定字段聚焦,然后为用户吐出这个.简而言之,即使您已经找到了使用PHP的方法,您最终还是会使用Javascript来完成它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读