Extremely Small Script

  • Howdy_McGee
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 22, 2010
  • Posts: 16
  • Status: Offline

Post July 16th, 2010, 9:15 am

JAVASCRIPT Code: [ Select ]
document.getElementById('list1').style.backgroundColor = "#00a94f";
document.getElementById('list1').style.color = "#000";
  1. document.getElementById('list1').style.backgroundColor = "#00a94f";
  2. document.getElementById('list1').style.color = "#000";


Does this look right?

I put it in my document and it doesn't seem to work, i'm not sure if I need a pound sign before the "list1" or not , but it looks right to me.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 16th, 2010, 9:15 am

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post July 16th, 2010, 9:35 pm

Looks fine to me. I'm thinking it's time to clean out the browser cache, then start looking elsewhere in the code if clearing the cache doesn't work.
Strong with this one, the sudo is.
  • Howdy_McGee
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 22, 2010
  • Posts: 16
  • Status: Offline

Post July 18th, 2010, 11:45 am

Thanks! Though why would clearing the browser cache mess with the scripts functionality at all?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post July 18th, 2010, 12:10 pm

The browser may be running the site from the cache, not the file source.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post July 18th, 2010, 8:22 pm

Like Bogey mentioned, the browser may be using a cached version of the page. I've had times when I was only working with a single file that has my JS/CSS/etc inside that file where for some reason the browser was continuing to use the copy of the page from 3-4 edits ago.

I don't catch it when does that because those last few edits are small incremental changes to something that hasn't been tested yet, whereas everything else on the page is working correctly. I end up thinking I'm doing something wrong when in actuality I had it right before.
Strong with this one, the sudo is.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Feb 17, 2005
  • Posts: 1585
  • Status: Offline

Post July 18th, 2010, 11:14 pm

This may be kind of off topic, but... I was thinking, just for the hell of it, with jQuery, couldn't you do that in 1 line?

Code: [ Select ]
$('#list1').css('color','#000').css('backgroundColor','#00a94f');


Every time I think of writing stuff in 1 line, I think of perl... Then I cringe.
There's no place like 127.0.0.1, badass part is now it's ::1
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post July 19th, 2010, 1:19 am

I believe jQueries css() method will accept an object.

JAVASCRIPT Code: [ Select ]
$('#list1').css({color:'#000', backgroundColor: '#00a94f'});
Strong with this one, the sudo is.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Feb 17, 2005
  • Posts: 1585
  • Status: Offline

Post July 19th, 2010, 11:39 am

Nice nice
There's no place like 127.0.0.1, badass part is now it's ::1

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 109 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.