RobG wrote:
windandwaves wrote: VK wrote:
windandwaves wrote:
var box = document.create Element('flashe r')
AFAIK there is not such HTML element. You maybe wanted to say:
var box = document.create Element('OBJECT ');
box.id = 'flasher';
?
You are so right. However, we create the object element further
down. I have added this instead:
var box = new getObj("flasher ");
where getObj returns the object ()
function getObj(name) {
if (document.getEl ementById) {
this.obj = document.getEle mentById(name);
this.style = document.getEle mentById(name). style;
}
}
That could be better written as:
function getObj(name)
{
this.obj = null;
this.style = null;
if (document.getEl ementById) {
this.obj = document.getEle mentById(name);
}
if (this.obj && this.obj.style) {
this.style = this.obj.style;
}
}
Now the error is box.appendChild is not a function.
No, it's not. box is a instance of your - getObj - object, and you
haven't defined an appendChild method for it. I think what you really
want to do is call the appendChild method of the element referenced by
box.obj (if there is one), i.e.:
box.appendChild (obj);
should be:
box.obj.appendC hild(obj);
or:
box.obj && box.obj.appendC hild && box.obj.appendC hild(obj);
I changed my function to this now and IT IS WORKING!
function getObj(name) {
this.obj = null;
this.style = null;
if (document.getEl ementById) {
this.obj = document.getEle mentById(name);
if (this.obj && this.obj.style) {
this.style = this.obj.style;
}
}
else if (document.all) {
this.obj = document.all[name];
this.style = document.all[name].style;
}
else if (document.layer s) {
this.obj = document.layers[name];
this.style = document.layers[name];
}
}
/**
* Create a flash object
*/
function makeflash(name, width, height) {
//if (!DHTML) return;
name = 'v/' + name + '.swf';
var box = document.getEle mentById("flash er");
var obj = createflashObje ct(name, width, height);
box.appendChild (obj);
obj.appendChild (createParam('m ovie', name));
obj.appendChild (createParam('q uality', 'high'));
obj.appendChild (createParam('b gcolor', '#000000'));
return box;
}
function createflashObje ct(name, width, height) {
var obj = document.create Element('object ');
obj.setAttribut e('type', 'application/x-shockwave-flash');
obj.setAttribut e('data', name);
obj.setAttribut e('width', width);
obj.setAttribut e('height', height);
return obj;
}
function createParam(n, v) {
var el = document.create Element('param' );
el.setAttribute ('name', n);
el.setAttribute ('value', v);
return el;
}
However, not in IE. Does anyone know how to get this baby going in IE?
I am basically trying to get this, but only after the page has been loaded.
The reason for this is that I use some other functions onload and i want
those to be carried out first as the flash is almost 1 meg and takes a while
to load....
<object type="applicati on/x-shockwave-flash" data="v/index.swf"
width="875" height="215">
<param name="movie" value="v/index.swf" />
<param name="bgcolor" value="#000" />
<a title="You must install the Flash Plugin for your Browser in order
to view this movie"
href="http://www.macromedia. com/shockwave/download/alternates/">get the
required <q>plug-in</q>: Macromedia Flash</a>
</object>
TIA
- Nicolaas