- HTML code
ajax分页
- PHP code
$pages?$pages:($start+5-1);
$end = $end>$pages?$pages:$end;
$start = ($end-5+1)<1?1:$end-5+1;
$link = '';
for($i=$start;$i<=$end;$i++) {
if($i == $page) {
$link .= $i;
continue;
}
$link .= ' ' . $i . ' ';
}
echo $link;
运行上面的html文件 可以显示 1 2 3 4 5
可一单击超链接时,firefox的debug显示 check is not defined
不是已经innerHTML进来了么,而且奇怪的是那个$page如果不加零的话显示的object element,望朋友解答!!!
------解决方案--------------------
这样呢
function check(node) {
var parameter = "page=" + node;
var nokia = ajax();
//alert(nokia);return;
nokia.open('POST',"process.php",true);
nokia.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
nokia.send(parameter);
nokia.onreadystatechange = function () {
if(nokia.readyState==4 && nokia.status==200) {
document.getElementById('span1').innerHTML = this.responseText;
}
}
}
window.onload = check(node);
------解决方案--------------------
- JScript code
window.onload = function ()
{
check(1);
}
function check(node) {
var parameter = "page=" + node;
var nokia = ajax();
//alert(nokia);return;
nokia.open('POST',"process.php",true);
nokia.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
nokia.send(parameter);
nokia.onreadystatechange = function () {
if(nokia.readyState==4 && nokia.status==200) {
document.getElementById('span1').innerHTML = this.responseText;
}
}
}
------解决方案--------------------