求点击下页显示一个URL递增的JS效果 就是 点击"下页" 链接,在不刷新当前页面的情况下,让当前页里的一个超链接地址按数字1递增, 数字的范围可指定.例如地址是: http://forum.csdn.net/down/1001.zip 文件名1001是需要递增的变量. 则每点"下页"一次,链接里的数字就按指定范围递增1位. 谢谢~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <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> 谢谢LS的,不过 这个递增的地址不和下页在一起的. 而是和"下页"按钮分开的,点击按钮 ,上面的那个超链接地址就递增一位,而且递增后的链接都是可点击的.不是alt弹窗提示.谢谢~ <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> jquery 如何设置按钮(input)的onclick事件? javascript 中不执行name.value js怎么获取iframe页面点击超链接后的地址 有没有一种方法,不用ajax,访问一个页面并且拿到该页面的返回值 请教一下~~~ 怎样得到在属性里没有设置图片长宽的图片的长度和宽度 firefox跨框架显示的问题,如何实现 一个很菜的问题!:( 无法设置<div>style的right属性? 这个函数怎么用JS写? fck的GetXHTML()很慢,大家有什么好办法么? js 怎么传值??
<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>
<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>