Home  >  Article  >  Backend Development  >  ?号动态获取传值,请指导。多谢

?号动态获取传值,请指导。多谢

WBOY
WBOYOriginal
2016-06-13 09:59:19950browse

?号动态获取传值,请指导。谢谢
现在我要做个分页,页面上有些数据是我修改了的,我想在我点击下一页的时候保存起来,
   
  具体如下:
我有一个文本框值为:123
我想点击点击下一页的时候得到这个123  
所以超链接的href就为:?ep=123

问题来了,现在我要怎么获得这个文本框的值呢?

  如果我把文本框中的值改为了456  
我点击下一页的时候链接就应该为:?ep=456

PHP接触不久,请指导。谢谢。

------解决方案--------------------
可以使用js处理:

HTML code
<input type="text" id="txt"><a href="./" id="next">下一页</a><script type="text/javascript">document.getElementById('next').onclick = function() {    var txt = document.getElementById('txt').value;    if (txt.length > 0) {        var url = this.href;        if ((url.split('?')).length > 1) url += '&';        url += '?ep=' + txt;    }    this.href = url;}</script><div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn