1. วิธีมาตรฐาน
คัดลอกรหัสรหัสดังนี้:
<script type = "text/javascript">
ฟังก์ชั่น openwin (src, ความกว้าง, ความสูง, showscroll) {
window.showmodaldialog (src, "", "ตำแหน่ง: ไม่; สถานะ: ไม่; ช่วย: ไม่; dialogwidth:"+width+"; dialogheight:"+ความสูง+"; wscroll+"; ");");
-
</script>
ตัวอย่าง: <span style = "เคอร์เซอร์: ตัวชี้" onclick = "openwin
('//www.vevb.com', '500px', '400px', 'no') "> คลิก </span>
2. ควรสังเกตว่า Firefox ไม่รองรับฟังก์ชั่น
window.open
('openwin.html', 'newwin', 'modal = ใช่, width = 200, ความสูง = 200, resizable = no, scrollbars = ไม่');
3. วิธีตัดสินเบราว์เซอร์โดยอัตโนมัติ
คัดลอกรหัสรหัสดังนี้:
<input type = "button" value = "เปิดกล่องโต้ตอบ" onclick = "showdialog ('#')"/>/>
<ภาษาสคริปต์ = "JavaScript">
-
ฟังก์ชั่น showdialog (URL)
-
if (document.all) // เช่น
-
feature = "dialogwidth: 300px; dialogheight: 200px; สถานะ: ไม่; help: no";
window.showmodaldialog (url, null, คุณสมบัติ);
-
อื่น
-
// modelessDialog สามารถแทนที่ modal ด้วย dialog = ใช่
feature = "width = 300, ความสูง = 200, menubar = no, toolbar = no, location = no," ;;;;;;;
คุณสมบัติ+= "scrollbars = ไม่, status = no, modal = ใช่";
window.open (url, null, คุณสมบัติ);
-
-
-
</script>
4. ใน IE กล่องโต้ตอบโมดอลจะซ่อนแถบที่อยู่ในขณะที่เบราว์เซอร์อื่นไม่จำเป็นต้อง
[หมายเหตุ] ใน Google Browser ผลของโมดอลนี้จะล้มเหลวเช่นกัน
5. โดยทั่วไปเมื่อกล่องโต้ตอบปรากฏขึ้นเราทุกคนหวังว่าพื้นหลังของหน้าพ่อทั้งหมดจะกลายเป็นสีโปร่งแสงเพื่อให้ผู้ใช้สามารถเห็นว่าพวกเขาไม่สามารถเข้าถึงได้ในภายหลัง
หลังจากปิดกล่องโต้ตอบฉันหวังว่าจะคืนค่า
สิ่งนี้ทำอย่างไร?
คัดลอกรหัสรหัสดังนี้:
/// แสดงข้อมูลรายละเอียดของลำดับที่แน่นอนผ่านกล่องโต้ตอบโมดอลและหน้าจอจะเปลี่ยนสี
ฟังก์ชั่น Showerderdetails (orderId) {
var url = "details.aspx? orderid =" + orderid;
// $ ("body")
// ตัวกรอง: อัลฟ่า (ความทึบ = 50)
$ ("body")
showdetailsdialog (URL, "600px", "400px", "ใช่");
$ ("body")
-
นอกจากนี้ยังมีคำจำกัดความของตารางสไตล์
. Body1
-
พื้นหลังสี:#999999;
ตัวกรอง: อัลฟ่า (ความทึบ = 40);
-
คัดลอกรหัสรหัสดังนี้:
< %@page language = "c#" autoeEventWireUp = "true" codebehind = "webform1.aspx.cs" สืบทอด = "webapplication1.webform1" %>
<!
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "เซิร์ฟเวอร์">
<title> </title>
<style type = "text/css">
.Body1 {{
พื้นหลังสี:#999999;
ตัวกรอง: อัลฟ่า (ความทึบ = 40);
-
</style>
<script src = "jQuery.js" type = "text/javascript"> </script>
<script type = "text/javascript">
ฟังก์ชั่น showdetailsdialog (src, ความกว้าง, ความสูง, showscroll) {{
window.showmodaldialog (src, "", "สถานที่: ไม่; สถานะ: ไม่; ช่วย: ไม่; dialogwidth:" + width + "; dialogheight:" + ความสูง + "; scroll +"; ");
-
ฟังก์ชั่น Showerderdetails (orderId) {
var url = 'detachs.aspx?
$ ("body")
showdetailsdialog (url, '500px', '400px', 'no');
$ ("body")
-
</script>
</head>
<body>
<found id = "form1" runat = "เซิร์ฟเวอร์">
<div>
<span style = "เคอร์เซอร์: ตัวชี้" onclick = "showorderDetails (11)"> คลิก </span>
</div>
</form>
</body>
</html>