PDA

View Full Version : Animated/static logo swap



Pivoteer
02-22-2008, 11:51 AM
before you say it, yes, im a newb.

is there a code to... hard to explain. some way to make a button that changes the logo at the top of your site when you click the button. Thing is, i have an animated logo and a non-animated logo for my site. so, like switch them around when you click the button.

Q2: my site is actually a PHPBB2 forum, so i need a code that makes a home page that, when i post a new announcment, and ONLY me, it comes up on my homepage. the perfect example is the http://www.droidz.org homepage.

ALL inputs will help:)

cheers all,
steve AKA pivoteer

P.S. all questions i ask will be posted here, not in other threads. just a heads-up. thanks.

Twey
02-22-2008, 12:10 PM
is there a code to... hard to explain. some way to make a button that changes the logo at the top of your site when you click the button. Thing is, i have an animated logo and a non-animated logo for my site. so, like switch them around when you click the button.
<img src="logo-static.png" alt="Site Logo" id="logo">
<button id="logo-button">Click me!</button>
<script type="text/javascript">
document.getElementById("logo-button").onclick = (function(n) {
var c = new Image();
c.src = n;

return function() {
var logo = document.getElementById("logo"),
t = logo.src;
logo.src = n;
n = t;
};
})("logo-animated.gif");
</script>
P.S. all questions i ask will be posted here, not in other threads. just a heads-up. thanks.Please don't -- post in the appropriate forums for their subjects (the former should be in the JS forum, the latter in the PHP forum, I'm just going to move the whole thread to JS for now). Also, if you post questions in separate threads you can give a descriptive title, which will allow people to decide faster whether they can help you or not.

Pivoteer
02-22-2008, 12:38 PM
oh, sorry.

thanks for your help, and ill try and use my commonsense next time ;)

cheers again,

pivoteer

EDIT: thanks twey, that post helped, but i would still really like a code for my second question. that would probably be my last question here, cos its all my site needs. its becoming really active now.

Twey
02-22-2008, 01:04 PM
It's more of a phpBB modification than anything else, so I'm not entirely comfortable writing it without a suitable test environment. It may very well already exist, however; check http://www.phpbbhacks.com/.

Pivoteer
02-22-2008, 11:22 PM
ok, cheers ill check it out.

ur da best ;)

pivoteer