RobG wrote:
RobG wrote:
Andrew Poulos wrote:
Given that I need to be able to add a TYPE attribute when I'm using
createElement and it seems to fail in both IE and FF (but not MZ)
Just checked the HTML 4 spec, TYPE attributes are allowed on
the following elements:
a (link), object, param, script, style, input, li, ol, ul and
button.
<URL:http://www.w3.org/TR/html4/index/attributes.html>
My limited example is on <input> types, what element were you
having trouble with?
Putting TYPE attributes on an OBJECT tag fails for me in FF.
Here's a sample that fails in FF but not MZ:
window.onload = function() {
addParam = function(p,n,v) { /* parent, name, value */
var c = document.createElement("param");
c.name = n;
c.value = v;
p.appendChild(c);
}
// parameters
var vidUrl = "media/sample.avi";
var vidTop = 100;
var vidLeft = 150;
var vidWidth = 320;
var vidHeight = 240;
var vidCont = 17; /* add 17px for the QT controller */
// create a DIV to contain the QT OBJECT
var v = document.createElement("div");
v.setAttribute("id", "videoContainer");
v.style.position = "absolute";
v.style.left = "0px";
v.style.top = "0px";
document.body.appendChild(v);
// QT OBJECT for non IE
var m = document.createElement("object");
m.data = vidUrl;
m.type = "video/quicktime";
m.width = vidWidth;
m.height = vidHeight + vidCont;
m.style.position = "absolute";
m.style.left = vidLeft + "px";
m.style.top = vidTop + "px";
addParam(m,"AutoStart","false");
addParam(m,"Controller","true");
v.appendChild(m);
}
- The DOM inspector shows that the TYPE attribute has not been added to
FF while it is in MZ.
- The AVI plays in MZ but FF tells me there's a missing plugin.
- If I write it into the HTML it works in FF
- If I use innerHTML it works in FF
- Moving the adding of the attributes to after the appending of the
OBJECT tag had no apparent effect, ie it still didn't work.
Andrew Poulos