บทความนี้อธิบายวิธีการลดหน้าต่างและอยู่ตรงกลางหลังจากคลิกที่ลิงค์ แบ่งปันสำหรับการอ้างอิงของคุณ การวิเคราะห์เฉพาะมีดังนี้:
นี่เป็นเอฟเฟกต์พิเศษ JS ที่เรียบง่าย ฉันไม่เคยเห็นมาก่อน เมื่อคลิกที่ลิงก์ข้อความที่ระบุบนหน้าหน้าต่างหน้าจะแคบลงและแสดงในศูนย์กลางจากนั้นเนื้อหาลิงก์จะปรากฏในหน้าต่างกลาง ฉันหวังว่าหน้าเว็บพิเศษเหล่านี้จะมีประโยชน์ในอนาคต
คัดลอกรหัสดังนี้: <html> <head>
<title> ตรงกลางหน้าต่าง </title>
<meta http-equiv = content-type content = "text/html; charset = gb2312">>
</head>
<body bgcolor =#fef4d9> <br> <br>
<enter>
<span> หน้าต่างถูกซูมออกและกึ่งกลาง </span>
</enter> <br>
<enter>
<Table BorderColor =#00ffff Border = 5 Borderlight = "Green">
<tbody>
<tr>
<td align = middle> <div align = "center"> <span> js เอฟเฟกต์แสดงผล </span> </div> </td>
</tr>
<tr>
<td align = ซ้าย>
<div align = "center">
<script>
ฟังก์ชั่น this_win (w, h) {
var ww = window.screen.width*w/100;
var hh = window.screen.height*h/100;
window.resizeto (ww, hh);
window.moveto (math.ceil ((window.screen.width-ww)/2), math.ceil ((window.screen.height-hh)/2));
-
</script>
<a onclick = this_win (50,50) href = "#"> คลิกที่นี่เพื่อ baidu </a>
</div> </td> </tr> </tbody> </table> </enter>
</body>
</html>
ฉันหวังว่าบทความนี้จะเป็นประโยชน์กับการเขียนโปรแกรม JavaScript ของทุกคน