Javascript style

This is a discussion on "Javascript style" within the JavaScript Forum section. This forum, and the thread "Javascript style are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 4th, 2006, 04:55
Junior Member
Join Date: Sep 2005
Location: Beyond the seas there's a town,In hand of each child a branch of insight lies,I shall build a boat.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Javascript style

Hello fireds
PHP: Select all

<html>
<
head>
<
script language="javascript">
document.getElementById("mylink").style.color="#0000ff";
document.write("salam");
</script>
 
 
</head>

<body>
<a id="mylink" href="http://www.dynamicdrive.com">Dynamic Drive</a>
</body>
</html
why color of the link does not chage?
GOOD LUCK!
Reply With Quote

  #2 (permalink)  
Old Sep 4th, 2006, 16:59
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Javascript style

Bit of a pointless question as it stands.

Change from what color to what color and under what cirumstances.
Reply With Quote
  #3 (permalink)  
Old Sep 4th, 2006, 20:11
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: Javascript style

it doesn't change because the script executes before the page has loaded.


change it to:
<html>
<
head>
<
script language="javascript">
window.onload = function(){
document.getElementById("mylink").style.color="#0000ff";
document.write("salam");
}
</script>


</head>

<body>
<a id="mylink" href="http://www.dynamicdrive.com">Dynamic Drive</a>
</body>
</html>
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
javascript, style

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
style MetallicWarfare Starting Out 12 Aug 13th, 2007 09:00
web style littlebilly Website Planning 7 Jul 22nd, 2007 14:58
How to tell IE7 to use a pariticular style in a single style sheet figo2476 Web Page Design 5 May 25th, 2007 14:23
Using javascript to alter style properties of a DIV flamin_mongrel JavaScript Forum 3 Oct 18th, 2006 21:34
Just for style? timmytots Web Page Design 4 Nov 17th, 2005 21:01


All times are GMT. The time now is 09:27.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43