JS獲取網(wǎng)頁圖片name屬性的方法
更新時間:2015年04月01日 11:17:55 作者:瘋狂一夏
這篇文章主要介紹了JS獲取網(wǎng)頁圖片name屬性的方法,涉及javascript操作圖片屬性的技巧,非常具有實用價值,需要的朋友可以參考下
本文實例講述了JS獲取網(wǎng)頁圖片name屬性的方法。分享給大家供大家參考。具體如下:
下面的JS代碼可以用來獲取網(wǎng)頁圖片的name屬性
<!DOCTYPE html> <html> <body> <img id="compman" name="compman" src="compman.gif" alt="Computerman" width="107" height="98"> <br> <script> document.write("Image name: "); document.write(document.getElementById('compman').name); </script> </body> </html>
希望本文所述對大家的javascript程序設計有所幫助。