Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorial] Removing DIV ads
Index -> Graphics and Design, Web Design -> (X)HTML Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rizzix




PostPosted: Mon Jan 23, 2006 5:31 pm   Post subject: [Tutorial] Removing DIV ads

Sometimes when you apply for a "free" web hosting service, most of these companies prepend really ugly and annoying DIV ads to your web page.

Here's a script that I've tested to work with both Firefox and IE6.

(Note: Check your web hosting providers' policies/agreements, before you decide to use this. Most of them do not permit you to remove those ads.)

Javascript:
var z = document.body.childNodes;
for (var i = 0;  i < z.length;  i++) {
    if (z[i].nodeName == "DIV") {
        z[i].style.visibility = "hidden";
        z[i].style.height = "0px";
        z[i].style.width = "0px";
        document.body.removeChild(z[i]);
    }
}
Just make sure all your webpages begin with that code

for example:
HTML:
<div>
    Hello World
</div>

<script language="javascript" type="text/javascript">
    var z = document.body.childNodes;
    for (var i = 0;  i < z.length;  i++) {
        if (z[i].nodeName == "DIV") {
            z[i].style.visibility = "hidden";
            z[i].style.height = "0px";
            z[i].style.width = "0px";
            document.body.removeChild(z[i]);
        }
    }
</script>


<div>
    Bye World
</div>
will display
HTML:
Bye World
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> (X)HTML Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: