This is a split board - You can return to the Split List for other boards.

Help with a HTML code line

  • Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.
  1. Boards
  2. PC
  3. Help with a HTML code line

User Info: Teritoclone

Teritoclone
4 years ago#1
Here's what I have:

<li><a href="#" onClick="setActiveStyleSheet('blue'); return false;"><span class="pre-color-skin4"></span></a></li>

Basically, when the user clicks the button, blue happens.

However, how do I script this so as soon as the page is loaded (no user interaction), blue happens?

Thanks :)
Kevin sent me.
PSN: Tigermisu

User Info: iceache

iceache
4 years ago#2
Remove the "OnClick" part?

User Info: Teritoclone

Teritoclone
4 years ago#3
iceache posted...
Remove the "OnClick" part?


That would make it so it doesn't change at all.
Kevin sent me.
PSN: Tigermisu

User Info: TheWayOfTheGun

TheWayOfTheGun
4 years ago#4
If you want to set that html element to blue or whatever css properties on page load then make a ondocument load script block and then set it.

I would use jquery since it makes it super easy and its syntax is based on css selectors.

$(function(){
$('a').css('background-color', 'blue');
});


There are a dozen ways to accomplish this but the best way is to just use CSS since you want it to happen on page load. You don't even need a script. Just give it a class and style it in a css sheet.


If you wanted to change the color on mouse click it's much cleaner and easier in jQuery also,

$(function(){
$('a').click(function() { $(this).css('background-color', 'blue'); } );
});
  1. Boards
  2. PC
  3. Help with a HTML code line

Report Message

Terms of Use Violations:

Etiquette Issues:

Notes (optional; required for "Other"):
Add user to Ignore List after reporting

Topic Sticky

You are not allowed to request a sticky.

  • Topic Archived