Làm popup giống trang tuoitre.vn

0
0
(0)

Làm popup giống trang tuoitre.vn

April 28th, 2012

Goto commentsLeave a comment

Câu hỏi: trên trang báo tuoitre.vn sau phía dưới mỗi tin, có một cái nút  hình email, nhấn vào đó sẽ hiện ra một cửa sổ nhỏ để gửi email đến bạn bè. Vui lòng hướng dẫn em cách thực hiện việc mở ra một cửa sổ nhỏ như thế.

Chào Bạn,

B1: Bạn hãy tự xây dựng một trang dùng để gửi email, giả sử trang đó là: sendmail.php

B2: Bạn dùng đoạn code sau đây để mở ra một số mới và tự động link đến file gửi email

<script language=”javascript” type=”text/javascript”>

function showWindow(url, isStatus, isResizeable, isScrollbars, isToolbar, isLocation, isFullscreen, isTitlebar, isCentered, width, height, top, left) {
if (isCentered) {
top = (screen.height – height) / 2;
left = (screen.width – width) / 2;
}

open(url, ‘_blank’, ‘status=’ + (isStatus ? ‘yes’ : ‘no’) + ‘,’
+ ‘resizable=’ + (isResizeable ? ‘yes’ : ‘no’) + ‘,’
+ ‘scrollbars=’ + (isScrollbars ? ‘yes’ : ‘no’) + ‘,’
+ ‘toolbar=’ + (isToolbar ? ‘yes’ : ‘no’) + ‘,’
+ ‘location=’ + (isLocation ? ‘yes’ : ‘no’) + ‘,’
+ ‘fullscreen=’ + (isFullscreen ? ‘yes’ : ‘no’) + ‘,’
+ ‘titlebar=’ + (isTitlebar ? ‘yes’ : ‘no’) + ‘,’
+ ‘height=’ + height + ‘,’ + ‘width=’ + width + ‘,’
+ ‘top=’ + top + ‘,’ + ‘left=’ + left);
}
function showDialog(url, width, height) {
return showWindow(url, false, false, false, false, false, false, true, true, width, height, 0, 0);
}

function onResponseClick(articlid) {

showDialog(‘http://[tên miền của bạn]/sendmail.php?id=’ + articlid, 550, 620);// 550 là chiều rộng, 620 là chiều cao

}

</script>

Và bạn đừng quên, trong sự kiện onclick lên tấm hình bạn hãy gọi function onResponseClick nhé

<img src=”../images/email.gif” onclick=”onResponseClick(‘<?php //echo $id của bài viết hiện tại ra đây?>’)” />

 

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave A Reply

Your email address will not be published.