Green
Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Monday, October 21, 2013

How to add javascript in wordpress blog

So go to your Dashboard==> Appearance ==> Editor

Then open Header.php and put the code just before

Or Open Footer.php and add The code just Before

Goodluck


View the original article here

Sunday, April 14, 2013

A Beginner Question In Javascript

getElements -- PLURAL, returns an array. you should either loop that array hitting all .first on the page, or use a unique ID with getElementsById...

I generally avoid getElementsByClassName since legacy browsers (old IE) don't support it.

Also, are you trying to ADD a class or replace it? This:
className= "active";

REPLACES it -- so it would no longer be 'first'. className is a string, so to add a new class you'd do:
className += ' active';

to ADD that class.

Though I'm not sure why you're playing with classes so much from Javascript... I mean, there are reasons to do it, but usually that's for goofy interactive crap that makes pages LESS useful.

But to be fair, I say that about 90%+ of the stuff people use Javascript to do on pages.


View the original article here