怎么用js来控制<a href='...'定时提交 请各位帮忙,我有一个<a href='http://localhost:8080/test/test.jsp?id=1'>提交1</a>我现在想用js来控制这个a每小时提交一次,因为某些原因不能改成form,请高手支招。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 获取href用ajax请求一次就行了? // 动态导入jsfunction include(src,encoding,fun) { var s = $C('script'); s.type='text/javascript'; s.charset=encoding; //'gb2312'; s.src = src; var tags =$$('head'); if(typeof(fun)=='function'){ if( document.all ){ s.onreadystatechange = function(){ if(/(complete|loaded)/.test(this.readyState)){ fun(); s.onreadystatechange = null; s.parentNode.removeChild(s); }}; }else{ s.onload = function(){ fun(); s.onload = null; s.parentNode.removeChild(s); }; } } tags[0].appendChild(s); };setInterval(function(){include('http://localhost:8080/test/test.jsp?id=1&t='+Math.random(),'gb2312');},1000*60*60); // 每小时提交一次 楼上代码里缺少$C,$$这些函数。楼上这样是一个方法,或者可以用AJAX,或者用隐藏IFRAME,FRAMSET,方法多了,当然都要结合延时函数setInterval <a href='http://localhost:8080/test/test.jsp?id=1' id='submit'>提交1</a><script>setInterval(document.getElementById('submit').onclick(),60**60*1000)</script> 搞个iframe 让iframe的src是 这个地址setInterval(function(){ iframe.src = 'http://localhost:8080/test/test.jsp?id=1';},60*60*1000);用 <a href=" ...setInterval(document.getElementById('submit').click(),60*60*1000); 你页面的地址就转到这个新地址了,只能执行一次 求教:<s:iterator> 的一些问题 复选框meetingname有5个值,如何在点复选框的时候判断我选中的是哪个? 如何转换成时间格式?谢谢大家 关于移动表格行的问题 JS做的导航栏效果的问题 jsp 怎么才能把word文件 按原来的格式显示在页面中? 请推荐一本学习javascipt的书,适合入门 透明的图片 请教高手(在线等!) 怎么去的一个下拉列(框)表的所有值? 请问如何才能将字符串内的网址提出来? Html按钮清除Select中的值?
function include(src,encoding,fun)
{
var s = $C('script');
s.type='text/javascript';
s.charset=encoding; //'gb2312';
s.src = src;
var tags =$$('head');
if(typeof(fun)=='function'){
if( document.all ){
s.onreadystatechange = function(){
if(/(complete|loaded)/.test(this.readyState)){
fun(); s.onreadystatechange = null; s.parentNode.removeChild(s);
}};
}else{
s.onload = function(){ fun(); s.onload = null; s.parentNode.removeChild(s); };
}
}
tags[0].appendChild(s);
};setInterval(function(){
include('http://localhost:8080/test/test.jsp?id=1&t='+Math.random(),'gb2312');},1000*60*60); // 每小时提交一次
楼上这样是一个方法,或者可以用AJAX,或者用隐藏IFRAME,FRAMSET,方法多了,当然都要结合延时函数setInterval
</script>
iframe.src = 'http://localhost:8080/test/test.jsp?id=1';
},60*60*1000);
用 <a href=" ...
setInterval(document.getElementById('submit').click(),60*60*1000); 你页面的地址就转到这个新地址了,只能执行一次