Showing posts with label XHTML. Show all posts
Showing posts with label XHTML. Show all posts

Sunday, May 10, 2009

Hiding Script

Hiding Script

When hiding script markup within a document, you may have to address what to do when a browser doesn’t support scripting. Traditionally when a browser encounters an element it doesn’t support it simply skips it and prints out the content within the element as plain text. A non-JavaScript-aware browser encountering an example such as;


Literally would print alert ("I am a script"); rather than running the script first. In order to avoid this undesirable situation, you should attempt to hide the script code from older browsers using comments, in fashion similar to the technique for hiding style sheets. An example of commenting on JavaScript is shown here;





Notice how the HTML comment starts the exclusion of JavaScript, but // as comments and does not attempt to run -- > as command.




Like other elements that reference technologies beyond basic markup, the script element supports a special element to deal with browsers that don’t execute a script. The
tag is used to enclose alternative text and markup for browsers that don’t interpret a script. Furthermore, users can turn off support for a scripting language in their browsers. The content renders onscreen, as shown below, if the user has turned off scripting support or is using a browser that doesn’t understand JavaScript.






Note; it is possibale to turn off JavaScript in browser rather easily by setting your preferences. This browser modification is performed by users primarily for security reasons, because there are many privacy exploits related to JavaScript usage.



Enter your email address:

Delivered by FeedBurner



My other blog;
1. Across this bridge
2.Struggling parents
4. When life become a book
5. Read Between the Lines
6. 7. The Sleeping Turtle Art Gallery

8. Marketing Myself

Add to Technorati Favorites

Subscribe in "Struggling Parents


Monday, May 4, 2009

Color in HTML

Transitional versions of HTML and XHTML support color settings for each text as well as for the background of the document, or even individual table cells. With style sheets, you will see that it is also possible to set foreground and background color names for nearly any element. There are 16 widely known color names defined in HTML. These names and their associated hex RGB values are shown below.

Black (#000000) Green (#008000)
Silver (#C0C0C0) Lime (#00FF00)
Gray (#808080) Olive (#808000)
White (#FFFFFF) Yellow (#FFFF00)
Maroon (#80000) Navy (000080)
Red (#FF0000) Blue (#0000FF)
Purple (#800080) Teal (#008080)
Fuchsia (#FF00FF) Aqua (#00FFFF)

To set a particular section of text yellow, simply surround the content with

Of course, in addition to the simple color names listed below, there are many others, some of which seem to have been introduced by the browser vendors. The problem with using browser-defined colors is that they don’t always do what they are suppose to do. Even worse, you can invent your own colors. Try setting the following and viewing it under Netscape and Microsoft Internet Explorer;

This color name is totally invalid, but it still results in a shade of green that is very distinct in each browser. It is possible to make up colors like “chilidog brown” or “stale beer yellow”, but this is no more recommended than using the browser-defined color “dodger blue”. Using hex color values is the preferred way to set colors because some nonstandard color names are not supported correctly across browsers.
Instead of using color names, we ought to use values that represent the color that we want. To understand how to come up with a color value, first consider that a computer displays color using a combination of red, green, and blue. We call this additive color process RGB color. The easiest way to think of RGB color is as a set of three dials that control the amount of red, green, and blue mixed into the final color. Because of the way computers calculate things, the color values range from 0 to 255 in decimal or 00 to FF if we count in hexadecimal like a computer scientist. So a color specified by 0,255,0 or equivalently 00,FF,00, is equivalently to the green dial turned way up and other dials turned off. This is a pure green. Equivalently, FF,00,00 is pure red. Finally, 00,00,FF is pure blue. Obviously, all dials off at 00,00,00 is the absence of color or simply black, whereas all dials on at FF,FF,FF is white. In HTML, we set these hex values using a pound sign and the equivalent RR,GG, and BB values are run together; for example, we could use the hex value #FFFF00 for the color attribute instead of the word “yellow”.
Rather than becoming an expert at hexadecimal, it is easy to use the Web editor to pick a color, a color reference can be found online at http://www.htmlref.com/colorchart.html .

Using Color
Page designers should be forewarned not to choose a link that can confuse their viewers. For example, reversing link colors so that visited links are blue and unvisited links are red could confuse a user. While it is unlikely that a page author would do such a thing, it has been done more than once-particularly in situations where the look and feel is the driving force of the site. Page designers also run into trouble when they set all link values to blue with the belief that users will revisit sections thinking they haven’t been there before. While this might make sense from a marketing standpoint, the frustration that results from lost navigation cues overrides any potential benefit from extra visits. Likewise, setting all the link colors to red could create similar trouble because users may think they have seen the site already.
Designers also must be extremely careful to preserve readability when setting text and background colors. Page designers often are tempted to use light colors on dark colors on dark backgrounds. For example, a gray text on a black background might look cool on every monitor, it will be unreadable. White and black always makes a good pairing and red certainly is useful in small doses. The best combination, in terms of contrast, actually is yellow and black, but imagine the headache from reading a page that looks like a road sign. Despite the generally high contrast, designers should be careful of white text on a black background particularly when font size are very small or thin font faces are in use.



Enter your email address:

Delivered by FeedBurner



My other blog;
1. Across this bridge
2.Struggling parents
4. When life become a book
5. Read Between the Lines
6. The Sleeping Turtle Art Gallery




Add to Technorati Favorites

Subscribe in "Struggling Parents


Thursday, April 2, 2009

Myths...

Myths About HTML and XHTML

The amount of hearsay, myths, and complete misunderstandings about HTML and XHTML is enormous. Much of this can be attributed to the fact that many people simply view the page source of sites or read quick tutorials to learn HTML. In the text that follows, I cover few of the more common myths about HTML and try to expose the truth behind them.

Myth; HTML is WYSIWYG design language
HTML isn’t a specific, screen- or printer- precise formatting language like PostScript. Many people struggle with HTML on a daily basis, trying to create perfect layouts by using HTML elements inappropriately or by using images to make up for HTML’s lack of screen and font handling features. Interestingly, even the concept of visual WYSIWYG editor propagates this myths of HTML as a page layout language. Other technologies, such as Cascade Style Sheets (CSS) are far better than HTML for handling presentation issues and their use returns HTML back to its structural roots.

Myth; HTML is a programming language
Many people think that making HTML pages is similar to programming. However, HTML is unlike programming in that it does not specify logic. It specifies the structure of a document. With the introduction of scripting languages such as JavaScript, however, the dynamic HTML (DHTML) is becoming more and more popular and is used to create highly interactive Web pages. Simply put, DHTML is the idea of a scripting language like JavaScript dynamically modifying HTML elements. DHTML blurs the lines between HTML as layout language and HTML as programming environment. However, the line should be distinct because HTML is not a programming language. Heavily intermixing JavaScript with HTML markup in the ad-hoc manner that many authors do is far worse than trying to use HTML as WYSIWYG markup language. Programming logic can be cleanly separated in HTML. Unfortunately, if this separation isn’t heeded, the page maintenance nightmare that results from tightly binding programming logic to content will dwarf the problems caused by misuse of HTML code for presentation purposes.

Myth; Traditional HTML is going away
HTML is the foundation of Web, with literally billions of pages in existence, not every document is going to be upgraded anytime soon. The “legacy” Web will continue for years, and traditional non-standardized HTML will always be lurking around underneath even the most advanced Web page years from now. Beating the standards drum upon high might speed things up a bit, but lets face the facts; there’s a long way to go before we are rid of messed up HTML markup.

Myth; XHTML will take the public Web by storm
Wishful thinking, but having taught HTML for years and having seen firsthand how both editors and others build Web pages, I can tell you that it is very unlikely that XHTML will be the norm anytime soon. Since the last millennium, it was predicted that the traditional HTML was dead. Yet today, documents are still primarily created both by editor and by hand sloppily, rarely conforming to even traditional HTML standards let alone XHTML.

myth; Hand-Coding of HTML Will Continue Indefinitely
Although some will continue to craft pages like mechanical typesetting, as the Web editors improve and produce standards markup perfectly, the need to hand-tweak HTML documents will diminish. I hope designers will realize that knowledge of the “invisible pixel” trick is not a bankable resume item and instead focus on development of their talents as they also pursue a firm understanding of HTML markup, CSS, and JavaScript.

Myth; HTML is All You Need to Know to Create Good Web Pages
Although HTML is the basis for Web pages, you need to know a lot more than HTML to build useful Web pages (unless the page is very simple). Document design, graphic design, and quite often programming are necessary to complete understanding of HTML technology can only aid document authors.










My other blog;
1. Across this bridge
2.Struggling parents
4. When life become a book
5. Read Between the Lines
6. The Sleeping Turtle Art Gallery