document.embeds example
RUN
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> #result{ color: red; font-size: 20px; font-weight: bold; } embed { display: inline-block; margin: 10px; width: 200px; height: 200px; } </style> </head> <body> <h1>Học lập trình miễn phí tại freetuts.net</h1> <embed src="#" width="200px" height="200px"> <embed src="#" width="200px" height="200px"> <p id="result"></p> <button onclick="myFunction()">Xem kết quả</button> <script> function myFunction(){ var length = document.embeds.length; document.getElementById("result").innerHTML = "Số thẻ 'embeds' tồn tại trên trang: " + length; } </script> </body> </html>
PHÓNG TO