我想做到:IFRAME里的子页面翻页后,父页面的URL地址跟着更新。
下面的代码可以更换URL地址,但是IFRAME的地址没有更新,切换'../index.php?page=1','../index.php?page=2','../index.php?page=3',IFRAME里都是page/1.php,我希望是'../index.php?page=2'时嵌入的是page/2.php,'../index.php?page=3'时嵌入的是page/3.php,求高手们给修正一下。index.php <!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=utf-8" />
 <title></title>
 <script type="text/javascript">
 String.prototype.getQuery = function(name) {
     var reg = new RegExp('\\b'+name+'=([^&].*)(&|$)', 'i');
     var arr = this.match(reg);
     return (arr && arr[1]) ? unescape(arr[1]) : null;
 }
 window.onload = function(){
     var url = window.location.href.toString();
  var page = url.getQuery('page');
 if (page) document.getElementById('items').src = 'page/' + page + '.php';
 }
</script>
</head>
<body>
<iframe id="items" src="page/1.php" frameborder="1" scrolling="no" height="40"></iframe>
</body>
</html>
page/1.php<!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=utf-8" />
<title></title>
</head>
<body>
页面A
<input type="button" value="PAGEA" onclick="parent.window.location =  '../index.php?page=1';" />
<input type="button" value="PAGEB" onclick="parent.window.location =  '../index.php?page=2';" />
<input type="button" value="PAGEC" onclick="parent.window.location =  '../index.php?page=3;" />
</body>
</html>