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

Reply via email to