...

View Full Version : JavaScript: Is it possible to stop a javascript function w/ other javascript code?



noni
01-18-2005, 10:09 PM
Hello ppl!

Can anyone help me out with this question?

Is it possible to block/stop a javascript function w/ other javascript command? How?

I got the following javascript code (it's an auto-adbox that apears - before the pages' <html> tag - every time the page w/ the code is loaded). I'd like to block/stop this code w/ other javascript code in the same page. Is it possible?

Ps.: Unfortunetly I can't erase/delete the "auto-adbox code" due to function reasons.

The "auto-adbox" code:



<HEAD>
<style type="text/css">
#adsbox{
position:absolute;
align: center;
left: 0;
top: -600px;
padding: 1px;
z-index: 100;
visibility:hidden;
}
</style>
<script type="text/javascript"><!--
var delay__time = 25;

function showadsbox()
{
var ie=document.all && !window.opera;
var dom=document.getElementById;
iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body;
objref=(dom)? document.getElementById("adsbox") : document.all.adsbox;
var docwidth=(ie)? iebody.clientWidth : window.innerWidth;
docheight=(ie)? iebody.clientHeight: window.innerHeight;
var objwidth=objref.offsetWidth;
objheight=objref.offsetHeight;
objref.style.left=docwidth/2-objwidth/2+"px";
objref.style.top= document.body.clientHeight -110;
if (objref.filters)
{
objref.filters[0].duration=0.8;
objref.filters[0].Apply();
objref.filters[0].Play();
}
objref.style.visibility="visible";
if (objref.style.MozOpacity) mozfadevar=setInterval("mozfadeads()", 90);
else setTimeout("hideadsbox()", (objref.filters)? (delay__time+objref.filters[0].duration)*1000 : delay__time*1000);
}

function mozfadeads()
{
if (parseFloat(objref.style.MozOpacity)<1) objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+0.5;
else
{
clearInterval(mozfadevar);
setTimeout("hideadsbox()", (objref.filters)? (delay__time+objref.filters[0].duration)*1000 : delay__time*1000);
}
}

// please NOTE function names and variables change every few months!
// Making it NOT worth your efforts to hack this script!! Sorry.
function hideadsbox()
{
objref.style.visibility="hidden";
}

function initads()
{
setTimeout("showadsbox()", 100);
}
if (window.addEventListener) window.addEventListener("load", initads, false);
else if (window.attachEvent) window.attachEvent("onload", initads);
else if (document.getElementById) window.onload=initads;
// --></script>

<html>
...then starts the page source code...


Any help is welcome! :)

jkd
01-19-2005, 12:08 AM
If your host puts an advertisement on your page, then you are most probably legally required to not circumvent it. We will not aid in this, it's against forum rules.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum