【发布时间】:2016-05-25 20:45:25
【问题描述】:
我正在尝试创建一个允许将两个 URL 输入到一个选项卡中的 chrome 扩展。我用frameset左右分开。代码如下:
Background.html
<!DOCTYPE html>
<html>
<head>
<title>A frame with two pages</title>
</head>
<frameset cols="*,*">
<frame src="left.html" name="left">
<frame src="right.html" name="right">
</frameset>
</html>
左右
<!DOCTYPE html>
<html>
<body onLoad="document.getElementById('urlToJump').value='http://www.foxnews.com/'">
<div class="menu">
<form>
<br>
<input type="text" id="urlToJump">
<br>
// Test 1 (custom input)
<input type="button" id="restore" value="Go to the URL above" onclick="window.location.href=document.getElementById('urlToJump').value;" />
<br>
// Test 2 (calling function)
<input type="button" value="Load new document" onclick="newDoc()">
</form>
</div>
<script>
function newDoc() {
window.location.assign("http://www.w3schools.com")
}
</script>
</body>
</html>
两个测试都没有工作,因为没有加载预期的目标。如何解决?我正在尝试重新创建找到 here 的 Chrome 扩展程序,并添加更多内容。谢谢!
【问题讨论】:
标签: javascript html google-chrome-extension