如何创建像StumbleUpon这样的工具栏来加载其他页面?

时间:2012-03-07 07:22:05

标签: javascript iframe

*不是浏览器扩展程序

以下是一些示例网站:http://www.thecollegecartel.com/ 当然还有:http://www.stumbleupon.com/

以下是操作工具栏的示例:http://www.thecollegecartel.com/out.php?pid=138339&type=next

1 个答案:

答案 0 :(得分:1)

如果您没有开发浏览器扩展程序,并且希望工具栏位于应用程序内部,那么您需要将网站拉入iframe。

这是一个非常粗略的片段,尚未经过测试,只是为了让您入门

...
<head>
   <script type="text/javascript">
      function changePage() {
         //fetch the next page url from somewhere
         document.getElementById('frame').src = 'some/new/page.html';
      }
   </script>
</head>
<body>

<div id="toolbar">
 <a id="fetchNextPage" href="javascript:changePage()" >next</a>
</div>


<iframe id="frame" src="firstPage.html" width="100%" height="450" frameborder="0" scrolling="no"></iframe>
相关问题