Trang chủTrang chủ Liên hệLiên hệ
PHP BASIC

» Events  » References  » Tutorials  » Hướng dẫn  RSS Feed2.0 Đăng ký | Đăng nhập

Dịch PHP Manual (đã dịch 86 /1248)
Thêm bài viết mới
#Thêm ý kiến
Emotion|Show / Hide
Một số cách để open 1 windows mới
cách 1: cách đơn giản nhất
<a href="http://phpbasic.com" target="_blank">PHPBASIC</a>
Demo: PHPBASIC
Cách 2:
<script>var new_window;
function popup(url)
{ new_window=window.open(url,'name','height=800,width=600');
if (window.focus) {new_window.focus()}
}</script>
<a href="javascript:popup('http://phpbasic.com');">Click here</a>
Demo: Click here
* nội dung của cửa sổ là nội dung của url
Cách 3:

<script type="text/javascript">
function popup()
{
var generator=window.open('','name','height=300,width=400,status=1');

generator.document.write('<html><head><title>Popup</title>');
generator.document.write('</head><body>');
generator.document.write('<h1>Welcome to phpbasic.com</h1>');
generator.document.write('<p>Noi dung cua o cua so nay do javascript qui dinh.</p>');
generator.document.write('<p><a href="javascript:alert(self.location.href)">Xem URL cua window</a>.</p>');
generator.document.write('<p><a href="javascript:self.close()">Close</a> the popup.</p>');
generator.document.write('</body></html>');
generator.document.close();
}
</script>
<a href="javascript:popup();">Click here</a>
Demo: Click here
* nội dung của cửa sổ do javascript qui định
Ghi chú: Đối số thứ 3 của hàm window.open có thể bao gồm các thuộc tính sau:

- height: chiều cao của popup, chỉ dùng đơn vị pixel (không dùng %)
- width: chiều rộng của popup, chỉ dùng đơn vị pixel (không dùng %)
- left: vị trí của popup so với lề trái của cửa sổ lớn
- top:vị trí của popup so với lề trái của cửa sổ lớn
- resizable: resize được kích thước của popup nếu là true
- scrollbars: xuất hiện scrollbars(thanh trượt) nếu là true
- toolbar: xuất hiên toolbar nếu là true
- menubar: xuất hiện menubar(File, Edit, ...) nếu là true
- location: hiển thị thanh điạ chỉ
- status: hiển thị status cho popup

focus và close cho popup
if (window.focus) {new_window.focus()} // focus
<a href="javascript:if(new_window) new_window.close()">Close</a>

Tác giả:TG
Webmaster
http://phpbasic.com

Show / Hide
#Thêm ý kiến

Add phpBasic to your browser's search box
Digg.com delicious Furl Google Bookmark Reddit Slashdot Yahoo My Web

Tableless template Framework PHP functions
 


XHTML Standard
Xây dựng & phát triển bởi tất cả các thành viên.
Powered by http://phpbasic.com