OB8*_*B85 2 html iframe jquery
我使用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>
Run Code Online (Sandbox Code Playgroud)
和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>
Run Code Online (Sandbox Code Playgroud)
有人请帮助我可以使用的jquery代码允许用户在输入字段中输入新的URL并重新加载iframe.
谢谢!!!
HTML的排序:
<input type="text" name="url" id="url"/>
<input type="submit" name="go" id="go" value="Go!"/>
<iframe id="miniBrowser"></iframe>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$('#go').on('click', function() {
$('#miniBrowser').attr('src', $('#url').val());
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16106 次 |
| 最近记录: |