The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 11:50:28 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: ECMAScript (JS) Skip Click to Deactivate on swfs in ie  (Read 2074 times)
nathanr
n00b
*
Offline Offline

Posts: 7


View Profile
« on: October 27, 2007, 12:37:24 PM »

swfobject is somewhat bulky and well not the same as just embedding via html, so I made this - will remove the click to deactivate from all flash on page load

Code:
function objectSkipActivate() {
/* simple skip deactivate by nathanr */
var x = document.getElementsByTagName('OBJECT');
for(var ob = x.length - 1; ob >= 0; ob--) {
var thisObjType = typeof(x[ob]);
if(thisObjType.toLowerCase() == 'object') {
/* build the object as valid xhtml */
var newObject = '<object type="'+x[ob].type+'" width="'+x[ob].width+'" height="'+x[ob].height+'" data="'+x[ob].data+'"';
if(x[ob].id) {
newObject += ' id="'+x[ob].id+'"';
}
var newStyle = x[ob].style;
newObject += '>';
/* add in the params */
var oP = x[ob].childNodes;
for(var p = oP.length - 1; p >= 0; p--) {
newObject += '<param name="'+oP[p].name+'" value="'+oP[p].value+'" />';
}
newObject += '</object>';
/* remake the object with the click to activate removed */
x[ob].outerHTML = newObject;
/* add in the styles */
for(s in newStyle) {
if(newStyle[s]) {
x[ob].style[s] = newStyle[s];
}
}
}
}
}

/* if you use my event handlers aswell then simply uncomment the following */
#add_event('load',objectSkipActivate,window);

just run it onload - jobs a goodun
« Last Edit: October 27, 2007, 12:49:37 PM by nathanr » Logged

No links in signatures please
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!