Home » » Tạo cửa sổ popup sử dụng Javascript


Đôi khi bạn phải sử dụng Popup window để tạo liên kết đến một trang web khác. Popup window thường xuyên được sử dụng trong thiết kế web. Bạn hãy click chuột vào liên kết Demo dưới đây để thấy tác dụng của thủ thuật này.
Xem Demo:

☼ Bắt đầu thủ thuật
1. Đầu tiên bạn hãy vào tài khoản blogger
2. Vào Thiết kế chọn Chỉnh sửa HTML
3. Bạn tìm thẻ.
</head>.
4. Dán code bên dưới vào sau thẻ trên.
<script type="text/javascript">
//<![CDATA[
function OpenPopup(Url,WindowName,width,height,extras,scrollbars) {
var wide = width;
var high = height;
var additional= extras;
var top = (screen.height-high)/2;
var leftside = (screen.width-wide)/2; newWindow=window.open(''+ Url +
'',''+ WindowName + '','width=' + wide + ',height=' + high + ',top=' +
top + ',left=' + leftside + ',features=' + additional + '' +
',scrollbars=1');
newWindow.focus();
}
//]]>
</script>
Tiếp theo thiết lập cấu trúc HTML như sau và đặt tại vị trí muốn hiển thị liên kết đến một trang web khác.
<a href="javascript: void(0);" onclick=" javascript:OpenPopup('http://quangvietmkt.blogspot.com/','WindowName','510','280','scrollbars=1');">Tên Hiển Thị</a>
Trong đoạn code HTML ở trên, bạn cần thay đổi những phần được đánh dấu màu đỏ cho phù hợp.

Tags:

0 nhận xét to "Tạo cửa sổ popup sử dụng Javascript"

Leave a comment

Renungan

Top Stories

Index »

Label 10

Info Nggladrah

Total Pageviews

See all posts

Label 4

Kesehatan

Seputar Mitos

Berita Aneh

Affiliates

Sport Video

See all videos

Video Category

Thời tiết và tỉ giá

QC

Index »

Label 5

Index »

Label 4

Label 1

Footer Widget 1

Label 3

Label 2

See all posts

Label 5

Template information

Iklan

Test Footer 2

Index »

Label 6

Được tạo bởi Blogger.

Berita Video

Search

Xem nhiều nhất