就是 点击"下页" 链接,在不刷新当前页面的情况下,让当前页里的一个超链接地址按数字1递增, 数字的范围可指定.例如地址是: http://forum.csdn.net/down/1001.zip   文件名1001是需要递增的变量. 则每点"下页"一次,链接里的数字就按指定范围递增1位. 谢谢~

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script type="text/javascript">
    window.onload = function(){
    var aTag = document.getElementById('next');
    aTag.onclick = function(e){
    preventDefault(e);
    var url = aTag.getAttribute('href');
    var count = parseInt(url.substr(url.lastIndexOf('/') + 1,5));
    var c = count + 1;
    aTag.setAttribute('href',url.substr(0,url.lastIndexOf('/')) + '/' + c + '.zip');
    alert(aTag.href);

    };

    function preventDefault(e){
    eventObject = e || window.event;
    if(eventObject.preventDefault){
    eventObject.preventDefault();
    }else{
    eventObject.returnValue = false;
    }
    };
    };
    </script>
    </head><body>
    <a href="http://forum.csdn.net/down/1001.zip" id="next">下一页</a>
    </body>
    </html>
      

  2.   

    谢谢LS的,不过 这个递增的地址不和下页在一起的. 而是和"下页"按钮分开的,点击按钮 ,上面的那个超链接地址就递增一位,而且递增后的链接都是可点击的.不是alt弹窗提示.谢谢~
      

  3.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script type="text/javascript">
    window.onload = function(){
    var aTag = document.getElementById('a');
    var butt = document.getElementById('next');
    butt.onclick = function(e){
    var url = aTag.getAttribute('href');
    var count = parseInt(url.substr(url.lastIndexOf('/') + 1,5));
    var c = count + 1;
    aTag.setAttribute('href',url.substr(0,url.lastIndexOf('/')) + '/' + c + '.zip');

    };
    };
    </script>
    </head><body>
    <a href="http://forum.csdn.net/down/1001.zip" id="a">跳转链接</a>
    <input type="button" id="next" value="点我增加" />
    </body>
    </html>