-
getAttribute(name)개발 관련/JAVASCRIPT 2009. 11. 12. 15:51
<script type="text/javascript"> //<!-[CDATA [ function imgfn() { var img = document.images[0]; var imgStr = "src = "+ img.getAttribute("src") + "<br />" + "width = "+ img.getAttribute("width") + "<br />" + "alt = "+ img.getAttribute("alt") + "<br />" + "align = "+ img.getAttribute("align"); var div1 = document.getElementById("div1"); div1.innerHTML = imgStr; } //]]> </script> <img src="dotty.gif" width="100" alt="an image" align="left" /> <input type="button" value="확인" onclick="imgfn();" /> <div id="div1"></div>
-- IE
-- FF
'개발 관련 > JAVASCRIPT' 카테고리의 다른 글
scrollHeight / clientHeight / scrollTop (0) 2010.03.15 Modifying Document (0) 2009.11.13 setAttribute(name,value) (0) 2009.11.12 Modifying Named Elements (0) 2009.11.06 HTMLTableRowElement (0) 2009.11.05