Extremely Small Script

  • Howdy_McGee
  • Novice
  • Novice
  • Howdy_McGee
  • Posts: 16

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

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.
  • Howdy_McGee
  • Novice
  • Novice
  • Howdy_McGee
  • Posts: 16

Post 3+ Months Ago

Thanks! Though why would clearing the browser cache mess with the scripts functionality at all?
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

The browser may be running the site from the cache, not the file source.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

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.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

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.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

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

JAVASCRIPT Code: [ Select ]
$('#list1').css({color:'#000', backgroundColor: '#00a94f'});
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Nice nice

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 70 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.