Jump to content

Jss Javascritp stylesheet


webspider25

Recommended Posts

Hi all,Its my first code and the most hurting part my first code is not working.I was trying to put JSS in my web page .ie, javascript stylesheet but its not workingI am writing the code below let me know where I am doing wrong.........<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><style type="text/JavaScript">tags.H1.textDecoration="underline";tags.H1.color="blue";</style></head><body><h1>The god is best</h1></body></html>Pls help meBye

Link to comment
Share on other sites

I don't know where you got the idea about javascript style sheets, but a quick Google search doesn't find anything. So you have to decide if you are using CSS style sheets, or javascript to set the style of your elements:CSS:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><style type="text/css">  h1 {text-decoration: underline; color: blue;}</style></head><body><H1>Hello world</H1></body></html>

OR java script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/JavaScript">  function changeH1Style()  {    var h1tags = document.getElementsByTagName("H1");    for (i=0; i< h1tags.length; i++)    {       h1tags[i].style.textDecoration = "underline";       h1tags[i].style.color="blue";    }  }</script></head><body><H1>Hello world</H1><script type="text/javascript">  changeH1Style();</script></body></html>

Kevin

Link to comment
Share on other sites

Yes, J(S)SS was created during the late '90s during the early stages of the "browser wars" between Netscape and Microsoft by Netscape as an alternative to Microsoft's CSS. However, it never really caught on (as MS got there first) and disappeared into the void :) modern browsers don't have implementations of JSSS, but the CSS properties of tags can still be modified through the use of the style class property as demonstrated by paynekj.What is wrong with CSS?

Link to comment
Share on other sites

Where should I start?
What's wrong with CSS?!?! Well... browser support in today's IE in comprarrison to today's browsers and... that's pretty much all bad I can think of.
More importantly, is there a tutorial online somewhere for Javascript stylesheets? And why?
No. Because it never cicked off enough.
Link to comment
Share on other sites

What's wrong with CSS?
I don't even have to think about that one. #1 - no box model property. There is a box model property in CSS3, so around the year 2140 the robots of the United Civilized States should be able to make use of that property. Sadly, they didn't include that in the first few drafts of CSS. Nearly every major CSS problem I've had has to do with differing box models. Being able to specify which model to use would have solved all of those. People can say what they want, but I think that the model that IE uses is more logical, it is more analagous to actual physical boxes and it is the same way that people like graphic artists think about design. People don't naturally think in terms of the W3C box model. I'll give you an example. If one dash is 1 foot, how wide is this box:
  -------    | box |  -------

If you said it's 7 feet wide then you think the way that graphic designers, builders, and myself do. If you think the way the W3C does then you think the box is 3 feet wide because of the 1 foot of padding on each side plus the 1 foot border, which aren't included in the width calculation. Being able to specify which box model I would like to use would have solved a lot of CSS problems over the years.The second major problem I have with CSS I don't even have to think about either. There is no sane way in CSS to create an arbitrary columned layout with a static header and footer (footer at the bottom of the screen, or the bottom of the content if the content is larger then the screen). There are hacks, hacks, and more hacks to try and emulate that, but there is no built-in support for it. Likewise, there is no sane way to create a multi-column layout where all columns are the same height, *or* to create two vertical columns that will both stretch to match the width of the larger one. By "sane" I mean a way that doesn't require a reference. I can write text formatting and most positioning things all day without a reference, if I want to set up a decent layout without tables then I need to go searching for hacks. A multi-column static-footer layout was just not in the minds of the people who designed CSS.

Link to comment
Share on other sites

I don't even have to think about that one. #1 - no box model property. There is a box model property in CSS3, so around the year 2140 the robots of the United Civilized States should be able to make use of that property. Sadly, they didn't include that in the first few drafts of CSS. Nearly every major CSS problem I've had has to do with differing box models. Being able to specify which model to use would have solved all of those. People can say what they want, but I think that the model that IE uses is more logical, it is more analagous to actual physical boxes and it is the same way that people like graphic artists think about design. People don't naturally think in terms of the W3C box model. I'll give you an example. If one dash is 1 foot, how wide is this box:
  -------    | box |  -------

If you said it's 7 feet wide then you think the way that graphic designers, builders, and myself do. If you think the way the W3C does then you think the box is 3 feet wide because of the 1 foot of padding on each side plus the 1 foot border, which aren't included in the width calculation. Being able to specify which box model I would like to use would have solved a lot of CSS problems over the years.

Back in the IE5 days, perhaps that was a lot bigger problem that it is now. On the very least, all browsers implement that model, so you could use that. The box-sizing property is truly something that should have been added from the start, but then again, so should have been inter dimensional calculations (99% - 1px). The spec has them now, and it's only a problem of those properties and features actually being supported.
The second major problem I have with CSS I don't even have to think about either. There is no sane way in CSS to create an arbitrary columned layout with a static header and footer (footer at the bottom of the screen, or the bottom of the content if the content is larger then the screen). There are hacks, hacks, and more hacks to try and emulate that, but there is no built-in support for it. Likewise, there is no sane way to create a multi-column layout where all columns are the same height, *or* to create two vertical columns that will both stretch to match the width of the larger one. By "sane" I mean a way that doesn't require a reference. I can write text formatting and most positioning things all day without a reference, if I want to set up a decent layout without tables then I need to go searching for hacks. A multi-column static-footer layout was just not in the minds of the people who designed CSS.
There is - the display:table; properties, but they are not supported in IE, which is practically what I meant by "browser support in today's IE in comprarrison to today's browsers". If IE had it, we'll be using it, forgetting about all other sorts of hacks already.
Link to comment
Share on other sites

If IE had it, we'll be using it, forgetting about all other sorts of hacks already.
Well sure, if all browsers immediately support the latest CSS spec then there wouldn't be any issues. But I'm living in reality, some of the things that we are waiting on vendors to implement should have been included in CSS1.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...