Jump to content
Sign in to follow this  
pijat

Close Window -javascript

Recommended Posts

assalamualaikum.............

nak tanye skit ape org panggil x button kat sebelah kanan/atas window tu yg ade button minimize n maximize tu? camne nak capture event nie mase user close window tu, in case user tak close window gune button yg ade dlm satu form/app....

ade sesape tau.......

Share this post


Link to post
Share on other sites

amenda ko cerita ni, tak paham la aku. kalau ko maksudkan javascript link bila ko click dia close window, guna

a href="JavaScript:onClick=window.close()"

je.

Share this post


Link to post
Share on other sites

bukan yg tu la....yg tu tak jadi masalah. yg saya tanye tu button X kat IE tuk close tu.

kat sebelah minimize n maximize tu. problem saya cam nie.......katakan kite ade satu form yang ade button close/cancel.

//cth camnie

<form name="taskeditor" action="test.php" method="post">

<input name='close' type='submit' id='close' value='Cancel'

onclick="window.close();"/></form>

dlm test.php tu plak ;

<?

if(isset($close)){

//do something

}

?>

klau user tu klik kat button close makne kite leh execute arahan dlm test.php tu tp bile user tak klik kat close button dlm form tu tp klik x (kat windows tu) camne? satu rasenye takleh kite disablekan close kat windows tu. tulah soalanya camne nak detect x close kat windows tu...........

Share this post


Link to post
Share on other sites

aku pun kurang faham, tapi dia nak program yang boleh capture window event. Dalam Microsoft Visual Studio ada satu program yang boleh capture window punyer event, cuba check. 3rd party pun ada cuba cari kat google. Sejauh mana event ni boleh membantu aku tak pastilah, tapi for sure tak banyak boleh membantu..

Share this post


Link to post
Share on other sites

sekali lg...mcm cth gmbr kat bwah nie..... yg ade tande merah tulah ape yg aku maksudkan. mslhnye camne nak tahu user klik kat button close kat situ..................

user posted image

Share this post


Link to post
Share on other sites

hmm kalo gitu ko nak check if user dah exit/close window tu kan?

gune statement if la kot.

if (window.close()) { //do something }

taktau la samada javascript ade event handler ke idak, but care atas probably leh jalan?

ako boleh carik bebetul, pasal kat browser ako, tiap2 kali ade site yang nak simpan cookies die akan prompt ako. and ade satu site yang ako tak ingat sori biggrin.gif yang bile ko tutup browser die akan store info kat cookies and probably die gune javascript la tu.

Share this post


Link to post
Share on other sites

jadi ade solution tak?

ko tau kan php ni skrip server side? dan mmg takde sebarang kawalan pada client side events

so the solution is to output a javascript function as C-Fu & azuan suggested

window.close(); 

Edited by puteranetwork

Share this post


Link to post
Share on other sites

saye ade try gune nie...........

<body onUnload="do_something();">

masalahnye skrg dlm konqueror 3.2 menda alah tak jln, saye dah try guna Mozilla n Netscape boleh berfungsi. susah bebenor aa dah tak tau event ape lg nak pakai..........

ade sesape yg tahu hrp dpt tolong noo............

Share this post


Link to post
Share on other sites

browser compatibility..

konqueror 3.2 is the latest version ke? try upgrade browser, else kena tunggulah latest update dari developer smile.gif . nothing we can do here.

Share this post


Link to post
Share on other sites

konq ako tak suke gune, so ako taktau camner.

tapi kalo die betul2 follow standards, then maybe, just maybe, ko kene set sebelum tag HEAD untuk pilih doctype yang macam HTML4.2 ke, xhtml transitional ke. then maybe boleh kot.

kalo taktau then right click opage ni then view source, tengok line paling atas.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...