Home > Web Front-end > JS Tutorial > body text

JavaScript pop-up basics_javascript skills

WBOY
Release: 2016-05-16 15:03:38
Original
1536 people have browsed it

confirm() means confirmation box

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>confirm</title>
</head>
<body>
<script>
var con=confirm("do you like to study javascript&#63;");
if (con) {
document.write("I love javascript!");
}
else{
document.write("I love other lanuages!");
}
</script> 
</body>
</html> 
Copy after login

prompt means message prompt box

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>confirm</title>
</head>
<body>
<script>
var pro=prompt("what is your name&#63;");
document.write(pro);
</script> 
</body>
</html> 
Copy after login

window.open(uri,name,attr)

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>confirm</title>
</head>
<body>
<a href="#" title="http://www.cnblogs.com/yuzheCyril/">click me</a>
<script>
var link=document.getElementsByTagName("a")[0];
link.onclick=function(){window.open(link.title,"blog","width=400px,height=400px");}
</script> 
</body>
</html> 
Copy after login

window.close() closes the window

The above is the relevant content of the JavaScript pop-up basics introduced by the editor. I hope it will be helpful to you!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template