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

WBOY
Release: 2016-06-13 13:53:36
Original
693 people have browsed it

?号动态获取传值,请指导。谢谢
现在我要做个分页,页面上有些数据是我修改了的,我想在我点击下一页的时候保存起来,
   
  具体如下:
我有一个文本框值为: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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!