<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>ไอดี</th> <th>รหัสผ่าน</th> <th>ชื่อ</th> <th>สกุล</th> <th>ระดับชั้น</th> <th>ภาพ</th> <th>qrcode</th> <th>แก้ไข</th> <th>ลบ</th> </tr> </thead> <tfoot> <tr> <th>ไอดี</th> <th>รหัสผ่าน</th> <th>ชื่อ</th> <th>สกุล</th> <th>ระดับชั้น</th> <th>ภาพ</th> <th>qrcode</th> <th>แก้ไข</th> <th>ลบ</th> </tr> </tfoot> <tbody> <?php while ($row1 = mysqli_fetch_array($result1)){?> <tr> <td><?php echo "". $row1["member_username"] ."";?></td> <td><?php echo "". $row1["member_password"] ."";?></td> <td><?php echo "". $row1["member_fname"] ."";?></td> <td><?php echo "". $row1["member_lname"] ."";?></td> <td><?php echo "". $row1["member_class"] ."";?></td> <td><?php echo "". $row1["img"] ."";?></td> <td> <input class="table table-bordered" width="100%" cellspacing="0" id="text" type="text" value="<?php echo "". $row1["member_username"] ."";?>"/><div class="table table-bordered" width="100%" cellspacing="0" id="qrcode" ></div></td> <td><a href="register_show_update.php?id=<?php echo "". $row1["id"] ."";?>"class="btn btn-warning">แกไข</a></td> <td><a href="register_show_del.php?id=<?php echo "". $row1["id"] ."";?>"class="btn btn-danger">ลบ</a></td> </tr> <?php }?> </tbody> </table> <script type="text/javascript"> var qrcode = new QRCode(document.getElementById("qrcode"), { width : 50, height : 50 }); function makeCode () { var elText = document.getElementById("text"); if (!elText.value) { alert("Input a text"); elText.focus(); return; } qrcode.makeCode(elText.value); } makeCode(); $("#text"). on("blur", function () { makeCode(); }). on("keydown", function (e) { if (e.keyCode == 13) { makeCode(); } }); </script> </body> </html>
function makeCode ( elText ) { // เปิดรับ object มาด้วย ไม่ต้องมาค้นหาเองซึ่งใช้ไม่ได้ //var elText = document.getElementById("text"); คำสั่งนี้ใช้งานไม่ได้ if (!elText.value) { alert("Input a text"); elText.focus(); return; } qrcode.makeCode(elText.value); // คำสั่งนี้ทำอะไร ไม่รู้ โค๊ดเอามาไม่หมด } // $('#text'). // คำสั่งนี้ ใช้ไม่ได้ เจอแค่อันแรกอันเดียว $('input [id="text"]') // อ้างอิงด้วย tag + attribute รายการที่ค้นหาได้จะเป็นแบบ array // ความหมายคือ ทุก tag input ที่มี id='text' เอาทุกอัน .on("blur", function () { makeCode(this); // ใส่ ออปเจคเข้าไปใน function ด้วย }) .on("keydown", function (e) { if (e.keyCode == 13) { makeCode(this); // ใส่ ออปเจคเข้าไปใน function ด้วย } });
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง