<object> tags use data="" not src="". Blame HTML 4. http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.3
-eric 2009/5/22 Darin Adler <[email protected]>: > On May 21, 2009, at 7:12 AM, naixuan guan wrote: > >> when I open the HTML page like follow: >> >> <OBJECT id="StormPlayer" width = 800 height = 400 src = "111"></OBJECT> >> <script language="JavaScript"> >> alert(document.StormPlayer.src); >> </Script> >> >> the warning message will show "undefined". why? > > Because not every HTML attribute has a corresponding JavaScript property. > > But alert(document.getElementById("StormPlayer").getAttribute("src")) should > work. > >> can I add the "src" attribute to "object" tag and can be modified by >> JavaScript? > > Yes, by calling objectElement.setAttribute("src", newSourceValue). > > -- Darin > > _______________________________________________ > webkit-dev mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

