<head> .... .... <meta http-equiv="cache-control" content="max-age=0" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> <meta http-equiv="pragma" content="no-cache" /> .... .... </head>thank you : http://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers
แสดงบทความที่มีป้ายกำกับ html แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ html แสดงบทความทั้งหมด
วันจันทร์ที่ 14 ตุลาคม พ.ศ. 2556
html meta tag no cache
วันอาทิตย์ที่ 7 เมษายน พ.ศ. 2556
change element div can editable same textarea : html
<div class="comment-item" contenteditable="plaintext-only" role="textbox"> comments </div>
วันพุธที่ 2 มกราคม พ.ศ. 2556
open new browser tab when click html link
... ... <!-- use html --> <a href="http://google.co.th" target="_blank">google</a> ... ... <!-- use javascript --> <a href="http://google.co.th" onclick="window.open(this.href); return false;">google</a> ... ... ...
วันอาทิตย์ที่ 19 สิงหาคม พ.ศ. 2555
วันจันทร์ที่ 1 สิงหาคม พ.ศ. 2554
เปลี่ยนปุ่ม upload file html
ปกติเราจะไม่สามารถเปลี่ยนปุ่มของการ upload file ได้ ถ้าเราใช้
<input type="file" name="upload"/>default ของแต่ละ browser จะต่างกัน บางอันเป็นภาษาไทย บางอันเป็นภาษาอังกฤษ เปลี่ยนเป็นชื่ออื่นก็ไม่ได้
แต่เราสามารถทำให้มันเหมือนกันได้ ดังนี้
<html> <body> <form action="uploadfile.php" method="post" enctype="multipart/form-data" target="ifrm" > <input type="file" name="upload" style="display:none" /> <input type="text" name="uploadtext" onkeydown="upload.value=uploadtext.value " /> <input type="button" name="uploadbutton" value="choose file" onclick="upload.click()" onmouseout="uploadtext.value=upload.value" /> <br /> <input type="submit" value="submit"/> </form> <iframe name="ifrm" style="display:none"> </iframe> </body> </html>
เราให้ <input type="file" name="upload" style="display:none"/> ทำงานอยู่เบื้องหลัง
แก้ปัญหา upload file ผ่าน ajax ไม่ได้
ajax ไม่ได้ถูกออกแบบมาสำหรับการ upload file
เราจึงต้องใช้วิธีอื่นเข้ามาช่วย เพื่อให้ดูเหมือนเป็นการทำงานของ ajaxวิธีนั้นก็คือ การใช้ iframe ดังนี้
<html> <body> <form action="uploadfile.php" method="post" enctype="multipart/form-data" target="ifrm" > <input type="file" name="upload"/><br /> <input type="submit" value="submit"/> </form> <iframe name="ifrm" style="display:none"> </iframe> </body> </html>
เราให้ไฟล์นั้นถูก upload ผ่าน iframe แทน
ซึ่งในที่นี้ iframe ถูกซ่อนอยู่
user จึงไม่เห็นการเปลี่ยนแปลงหรือการรีเฟรชใดๆเกิดขึ้นบน page นี้
หมายเหตุ : enctype ต้องมีเสมอ หากมีการ upload file เกิดขึ้น
เนื่องจาก เราต้องแปลงไฟล์ให้อยู่ในรูปของ binary file ก่อน จึงจะสามารถส่งไปให้ upload.php ทำการ upload ขึ้นสู่ server ได้
สมัครสมาชิก:
บทความ (Atom)