<!DOCTYPE html><html><body><img id="klematis lilac" border="0" src="klematis.jpg" width="148" height="112"><img id="klematis pink" border="0" src="klematis2.jpg" width="149" height="118"><p>Id of first image:<script>document.write(document.images[0].id);</script></p></body></html>运行结果如下:
Id of first image:klematis lilac希望本文所述对大家的javascript程序设计有所帮助。