[webkit-dev] How to add a attribute for "object" tag and can be modified by JavaScript
naixuan guan
guannaixuan at gmail.com
Thu May 21 18:21:29 PDT 2009
yes , I know "object" tag use "data" not "src", but I want to realize the
"src" attribute :)
2009/5/21 Eric Seidel <eric at webkit.org>
> <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 <darin at apple.com>:
> > 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
> > webkit-dev at lists.webkit.org
> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090522/3a790386/attachment.html>
More information about the webkit-dev
mailing list