บทความนี้อธิบายถึงวิธีการของหน้าป๊อปอัพ JavaScript เพื่อส่งผ่านค่าย้อนกลับ แบ่งปันสำหรับการอ้างอิงของคุณ วิธีการใช้งานเฉพาะมีดังนี้:
a1.html
คัดลอกรหัสดังนี้: <! Doctype html public "-// w3c // dtd html 4.0 transitional // en">
<html>
<head>
<title> หน้าต่าง 1 </title>
</head>
<body>
<H1> หน้าต่าง 1 </h1>
<input type = "text" name = "A">
<อินพุต type = "ปุ่ม" onclick = "return test ();" -
<script>
ฟังก์ชั่นทดสอบ () {
window.open ('b1.html', 'newwindow', 'ความสูง = 100, ความกว้าง = 400');
-
</script>
</body>
</html>
b1.html
คัดลอกรหัสดังนี้: <! Doctype html public "-// w3c // dtd html 4.0 transitional // en">
<html>
<head>
<title> เอกสารใหม่ </title>
</head>
<body>
<H1> หน้าต่าง 2 </h1>
<อินพุต type = "text" name = "b" value = "11"> <อินพุต type = "ส่ง" onclick = "return test ();">
<script>
ฟังก์ชั่นทดสอบ () {
var bvalue = 111;
window.opener.a.value = bvalue;
window.close ();
-
</script>
</body>
</html>
ฉันหวังว่าบทความนี้จะเป็นประโยชน์กับการเขียนโปรแกรม JavaScript ของทุกคน