水曜日, 1月 6th, 2010 Posted in JavaScript | No Comments »
○JavaScriptの部分 [sourcecode language="js"] function testFnc(){ //prototypeを使わない場合: var imgTag = document.getElementById("sample"); imgTag.setAttribute("src", "sample2.jpg"); //prototypeを使う場合: $("sample").setAttribute("src", "sample2.jpg"); } [/sourcecode] ○HTMLの部分 [sourcecode language="html"] <img src="sample1.jpg" id="sample" /> [/sourcecode] prototypeを使うと上記のように省略して書くことが出来る。 Read more..