Yesterday, I wanted to follow renrenren's web-based title flashing function (simple JS Code), that is, when someone sends a new message, the title blinks, use js to implement the switch between "New message" and "play personal homepage" = "and" play personal homepage. The code is actually very simple. One problem is that when multiple spaces are entered in the title, only one space is displayed. Solution: Switch the Input Method to the Chinese fullwidth, and then display multiple spaces.
<! 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 = UTF-8"/>
<Title> personal homepage </title>
<SCRIPT type = "text/JavaScript">
VaR step = 0;
VaR tit = Document. title;
Function flash_title (){
Step ++;
If (step = 3) {step = 1 ;}
If (step = 1) {document. Title = '[new message]' + tit;} // Chinese fullwidth Space
If (step = 2) {document. Title = '[' + ']' + tit;} // Chinese fullwidth Space
SetTimeout ("flash_title ()", 1000 );
}
Window. onload = function (){
Flash_title ();
}
</SCRIPT>
</Head>
<Body>
</Body>
</Html>