Wordpress Themes - Submit Articles - Debt Consolidation - Kamala Harris - William Hill Vouchers

PDA

View Full Version : If statement looking for a Class name in HTML


Luis Grolez
Jul 6th 2008, 6:26 pm
Hi,
I would like to make my IF STATEMENT to look for a Class name in the HTML called "breadcrumb" instead of looking for the Title Name of the page.

This is the code a was up to:

<script type="text/javascript">
if (document.title == "Rugs"){
document.getElementById('content').className='template-list';
} else {
document.getElementById('content').className='template-details';
}
</script>

Thanks.

gezzle
Jul 6th 2008, 11:17 pm
if you're searching class name you can use yui dom method:
http://developer.yahoo.com/yui/examples/dom/getelementsbyclassname.html

Luis Grolez
Jul 6th 2008, 11:46 pm
Thanks, I'm good now.