How to Use the _ HTML/XHTML _ webpage in Xhtml code to mark Marquee

Source: Internet
Author: User
Marquee was abandoned by W3C. This sentence is actually incorrect. Why? Because Marquee has never been regarded as a formal tag by W3C. In the forum, I saw the netizen jeanjean20 mentioned how to modify Marquee to meet the standards. I read my friends' posts and thought it was quite good. The moderator greengnn indicated that Marquee was not compliant with the standards and had been abandoned by W3C. Some friends say that they think it is unreasonable to go through the unfair competition. The effect is now quite good. Some friends also said that they had gone well, so it was annoying to look at it. Everyone has their own perspectives, but how do we understand it is one thing, but we need to figure out why. Here I will modify and add some content after drawing the greengnn conclusion, I hope you can understand and understand it.

The first thing to be corrected is that Marquee has been abandoned by W3C. This sentence is actually incorrect. Why? Because Marquee has never been regarded as a formal tag by W3C. W3C has never set this label, let alone "abandon. This is like divorce before we get married. In fact, Marquee, like many other tags, is private by Microsoft, Netscape, and other companies. W3C has never recognized this label. This is the case for a wealthy company, but a non-profit organization is hard to understand!

Why does W3C never recognize Marquee? I would like to say that this label is also a screw driver in the eyes of the majority of web designers! In our early years, we thought that technical strength was the capital to show off. But now I don't want to use it. (This is a question: many people say that W3C is not used. This is all wrong. W3C has no right to restrict you from using it or not .), Why? We need to clarify what this standard is. Standards are not a technology, but a standard and proposal. We still use the tags in the original HTML4.0. The standard does not add any tags to our XHTML, but provides the recommended tags (for example, p, p, ul, dl, span, em ...), Which of the following statements are not recommended (for example, font, B, u, I ...), It also advocates the need for semantics and use norms. Of course, the standard is not only XHTML, but also CSS, DOM, and scripting language. Many people think that CSS is produced after the standard, but it is not. CSS has been available for a long time, and the standard is the same as CSS. They advocate that some CSS developed by some browser vendors should not be used, for example, CSS Filter.

Another important point in the standard is functional separation. Divided into three parts: structure, style, and behavior. These three parts include structure (xHTML, XML), sample (CSS), and behavior (DOM, ECMAScript ). Here we will go back and think about why the Marquee is not recognized by W3C. I think everyone should understand it. Like tags such as FONT and B, it is no longer a structural tag. They carry style and behavior characteristics, and then draw them into the structure of the category is obviously more than a lot.

Therefore, if you want to retain or implement the effect of Marquee, you need to pay more attention to JavaScript. The scripting language will certainly make your web page dynamic. To make the place you specify dynamic, pay attention to the use of ID and CLASS in the tag.

To make it easier for everyone to use this interesting effect, I specially asked zookeeper to write a piece of JS and read the following code:

JS Code:

The Code is as follows:


Function getElementsByClass (searchClass, tagName ){
Var classElements = new Array ();
If (tagName = null)
TagName = '*';
Var els = document. getElementsByTagName (tagName );
Var elsLen = els. length;
Var pattern = new RegExp ("(^ | \ s)" searchClass "(\ s | $ )");
For (I = 0, j = 0; I <elsLen; I ){
If (pattern. test (els [I]. className )){
ClassElements [j] = els [I];
J;
}
}
Return classElements;
}
Function ccMarquee (className ){
Var a = getElementsByClass (className );
For (I = 0; I <a. length; I ){
A [I]. innerHTML =" "A [I]. innerHTML" ";
}
} Window. onload = function (){
CcMarquee ("ccMarquee ");
}


XHTML code:


The Code is as follows:



Here is the rolling



Please pay attention to the fact that you only need to add Class = "ccMarquee" to the peripheral labels of the rolling effect. Case sensitive.

Appendix: Tag attributes

Please read the following code first


The Code is as follows:


Enter the scrolling content here.


Now let's analyze it in detail.

◎ Direction indicates the scroll direction. The value can be left, right, up, or down. The default value is left.
◎ Behavior indicates the scroll mode. The value can be scroll (continuous scroll) slide (slide once) alternate (round-trip scroll)
◎ Loop indicates the number of cycles. The value is a positive integer. The default value is an infinite loop.
◎ Scrollamount indicates the motion speed. The value is a positive integer and the default value is 6.
◎ Scrolldelay indicates the pause time. The value is a positive integer. The default value is 0. The unit seems to be milliseconds.
◎ Align indicates the vertical alignment of elements. The values can be top, middle, and bottom. The default value is middle.
◎ Bgcolor indicates the background color of the motion area. The value is a hexadecimal RGB color. The default value is white.
◎ Height and width indicate the height and width of the moving area. The value is a positive integer (in pixels) or percentage. The default width = 100% height indicates the height of the element in the label.
◎ The horizontal distance and vertical distance between the element and the region boundary are expressed in the form of a positive integer in pixels.
◎ Onmouseover = this. stop () onmouseout = this. start () indicates that the scroll stops when the mouse moves above the area and continues to scroll when the mouse moves away.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.