如何在我的脚本之前弹出警报
how to make an alert pop up before my script
我是 js 的新手,我正在做一些事情,这个东西制作了一堆新标签,但是当代码是 运行 时,当每个标签打开时弹出警报个人标签。
这是代码
<script>
alert('something')
setInterval(function() {
var w = window.open();
w.document.write(document.documentElement.outerHTML||document.document
Element.innerHTML);
}, );
</script>
请多多关照我是新人
这个怎么样
<!DOCTYPE html>
<html>
<body>
<p>Click the button to open a new browser window.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert("Hi there");
window.open("https://www.w3schools.com");
}
</script>
</body>
</html>
我是 js 的新手,我正在做一些事情,这个东西制作了一堆新标签,但是当代码是 运行 时,当每个标签打开时弹出警报个人标签。 这是代码
<script>
alert('something')
setInterval(function() {
var w = window.open();
w.document.write(document.documentElement.outerHTML||document.document
Element.innerHTML);
}, );
</script>
请多多关照我是新人
这个怎么样
<!DOCTYPE html>
<html>
<body>
<p>Click the button to open a new browser window.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert("Hi there");
window.open("https://www.w3schools.com");
}
</script>
</body>
</html>