【发布时间】:2010-09-07 08:09:15
【问题描述】:
我使用 iframe 在浏览器窗口中创建了一个基本浏览器:
目的是允许使用 jquery 对元素进行鼠标悬停样式,即/突出显示所有红色链接等...更改字体等..
我创建了两个文件:
browser.php
<html>
<head>
<title></title>
<style>
#netframe {
float:right;
height: 100%;
width: 80%;
}
#sidebar {
float:left;
height: 100%;
width: 20%;
}
</style>
</head>
<body>
<div id="container">
<div id="sidebar">
Enter A URL:
<input type="text" name="url" id="url">
<input type="button" value="load" id="load">
<br><br>
</div>
<div id="netframe">
<iframe height="100%" width="100%" class="netframe" src="pullsite.php" id="main_frame"></iframe>
</div>
</div>
</body>
</html>
还有pullsite.php
<html>
<head>
<title></title>
<link href="css/reset.css" rel="stylesheet" type="text/css">
<style>
.highlight {
outline-color: -moz-use-text-color !important;
outline-style: dashed !important;
outline-width: 2px !important;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<div id="contents">
<?php echo file_get_contents('http://www.google.com/webhp?hl=en&tab=iw'); ?>
</div>
<script>
$("#contents").contents().find("a").addClass("highlight");
</script>
</body>
</html>
谁能帮助我可以使用的 jquery 代码允许用户在输入字段中输入新的 url 并重新加载 iframe。
谢谢!!!
【问题讨论】: