我是新来的stackoverflow,我来到这里,因为我无法找到明确的答案,我的问题与HTML和JavaScript。将数据从选项卡1传递到选项卡2
我想用3个按钮来显示一个HTML页面和按钮将执行3个脚本的onClick。我需要标签#谈谈标签#2,以执行代码,但我坚持我如何去这样做 - 这是我的HTML代码:
<!DOCTYPE html>
<html>
<body>
<!-- START STAGE 1 -->
<script>
function stage1()
{
// Here I want to open up a new tab so I'd do:
window.open('http://webpage.com', '_blank');
}
</script>
<!-- START STAGE 2 -->
<script>
function stage2()
{
// From here, I want to execute some JavaScript to the new tab I've opened
}
</script>
<!-- START STAGE 3 -->
<script>
function stage3()
{
// Again, I want to execute another script on the new tab I've opened
}
</script>
<button type="button" onClick="stage1()">STAGE1</button>
<hr />
<button type="button" onClick="stage2()">STAGE2</button>
<hr />
<button type="button" onClick="stage3()">STAGE3</button>
</body>
</html>
我会很感激,如果有人可以重新 - 写下这段代码,并在3的代码中留下一个空格,让我的代码从#1的标签#2开始执行。
预先感谢您! - 对不起,我有点小菜哈哈。 干杯, 德克兰土地
你可能想看看这个:http://stackoverflow.com/questions/3203530/accessing-the-content-of-other-tabs-in-browser – 2013-03-19 14:58:16
我会看看 - 欢呼快回复男人! – iOSDec 2013-03-19 15:00:15
你在每个标签中显示什么? – Pete 2013-03-19 15:16:36