W
windandwaves
Hi Folk
I am trying to add flash onload
This is the function I came up with:
function makeflash(name, width, height) {
//if (!DHTML) return;
name = 'v/' + name + '.swf';
var box = document.createElement('flasher')
var obj = createflashObject(name, width, height);
box.appendChild(obj);
obj.appendChild(createParam('movie', name));
obj.appendChild(createParam('quality', 'high'));
obj.appendChild(createParam('bgcolor', '#000000'));
return box;
}
function createflashObject(name, width, height) {
var obj = document.createElement('object');
obj.setAttribute('type', 'application/x-shockwave-flash');
obj.setAttribute('data', name);
obj.setAttribute('width', width);
obj.setAttribute('height', height);
return obj;
}
function createParam(n, v) {
var el = document.createElement('param');
el.setAttribute('name', n);
el.setAttribute('value', v);
return el;
}
It does not give any errors, but it is not working either.
my html looks as follows:
....header here
<body onload="makeflash('abc.swf', 100, 100);">
<div id="flasher"></div>
....etc...
I should probably use getelementbyid rather than createlement, but that does
not seem to work either
any help greatly appreciated.
Thank you
I am trying to add flash onload
This is the function I came up with:
function makeflash(name, width, height) {
//if (!DHTML) return;
name = 'v/' + name + '.swf';
var box = document.createElement('flasher')
var obj = createflashObject(name, width, height);
box.appendChild(obj);
obj.appendChild(createParam('movie', name));
obj.appendChild(createParam('quality', 'high'));
obj.appendChild(createParam('bgcolor', '#000000'));
return box;
}
function createflashObject(name, width, height) {
var obj = document.createElement('object');
obj.setAttribute('type', 'application/x-shockwave-flash');
obj.setAttribute('data', name);
obj.setAttribute('width', width);
obj.setAttribute('height', height);
return obj;
}
function createParam(n, v) {
var el = document.createElement('param');
el.setAttribute('name', n);
el.setAttribute('value', v);
return el;
}
It does not give any errors, but it is not working either.
my html looks as follows:
....header here
<body onload="makeflash('abc.swf', 100, 100);">
<div id="flasher"></div>
....etc...
I should probably use getelementbyid rather than createlement, but that does
not seem to work either
any help greatly appreciated.
Thank you