<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<script language="javascript">
document.write('<scr'+'ipt language="javascript" src="js/myown_func.js" ></scr'+'ipt>');
</script>
<script language="javascript">
var url = "/newjs.php?num=12";
document.write('<scr'+'ipt language="javascript" src="'+url+'" ></scr'+'ipt>');
</script>
<body>
<SCRIPT>
document.writeln("<a href=\""+TOPSITE[0]+"\" target=\"_blank\" ><\/a>");
document.writeln("<a href=\""+TOPSITE[1]+"\" target=\"_blank\" ><\/a>");
document.writeln("<a href=\""+TOPSITE[2]+"\" target=\"_blank\" ><\/a>");
document.writeln("<a href=\""+TOPSITE[3]+"\" target=\"_blank\" ><\/a>");
document.writeln("<a href=\""+TOPSITE[4]+"\" target=\"_blank\" ><\/a>");
document.writeln("<a href=\""+TOPSITE[5]+"\" target=\"_blank\" ><\/a>");
</SCRIPT>
</body>
</html>
newjs.php输出效果:var TOPSITE=new Array();
TOPSITE[0]="http://www.baidu0.com"
TOPSITE[1]="http://www.baidu1.com"
TOPSITE[2]="http://www.baidu2.com"
TOPSITE[3]="http://www.baidu3.com"
TOPSITE[4]="http://www.baidu4.com"
TOPSITE[5]="http://www.baidu5.com"
TOPSITE[6]="http://www.baidu6.com"
TOPSITE[7]="http://www.baidu7.com"
TOPSITE[8]="http://www.baidu8.com"
TOPSITE[9]="http://www.baidu9.com"
TOPSITE[10]="http://www.baidu10.com"
TOPSITE[11]="http://www.baidu11.com"
我想实现点击完第一个url(www.baidu0.com)后,自动的www.baidu1.com漂移到html第一个位置。
就是无刷新的更新一下js输出的newjs.php内容。有没有好的办法?或者思路
无刷新指的是后台与前台的配合。js本来就是无刷新的了。
使用AJAX+JS DOM操作即可
假如你的AJAX的代码没有一次通过,那么即使在你更改正确后,页面也许还是错误的,这个是讨厌的浏览器缓存造成的,
万恶的缓存,我在这上面耽搁了至少1整天
所以你最好在服务器应答页面写上禁止缓存的语句 response.setHeader("Cache-Control","no-cache");
(请求url后面+当前系统的毫秒数也是一种方法。在js中用new Date().getTime()来获取系统与某一特定时间的毫秒差额。). 3.因为当前IE的一些标准不完全符合W3C。例如:
监视控件的改变我们都知道onchange事件,但是对于text控件IE是不支持onchange属性的,所幸我们onpropertychange事件来监听text。
再如我们在除IE以外的浏览器中设置CSS属性可以使用setAtrribute(),但是在IE中不支持,同样我们使用EObj.style.stylearrtibute=value来实现。