Add a flash clock to your blog

Source: Internet
Author: User

I vaguely remember seeing that kind of dynamic flash clock control in the news bulletin board of a huge bull in many blogs of cnblogs. First:

 

As a newbie, I'm naturally curious. In the blog setting options, search (thought it was the function provided by cnblogs...), and the theme style was changed several times, that is, the flash style was not found. However, you can find the "blog sidebar announcement" in the settings ,.

I think of my experience of searching for free QQ space-themed JS Code on the Internet when I first went to college. I feel like it is the breakthrough. I asked du girl a little and found a solution, which is summarized as follows:

1. Add an object tag

Since HTML code is supported, the flexibility is great. Find the URI of this cool flash clock SWF resource and set the tag attribute of the object. Go to the Code:

1 <object width="200" height="75" data="http://files.cnblogs.com/arthurymn/honehone_clock_wh.swf" type="application/x-shockwave-flash">2   <param name="src" value="http://files.cnblogs.com/arthurymn/honehone_clock_wh.swf" />3 </object>

 

You only need to change the value of the data attribute to the URI of your flash. Of course, the width and height must be adjusted according to the page conditions. Here is a more user-friendly place. On the "Management-Files" page of the blog, you can upload your own local flash, and then the SWF file will become your external resource chain, there is no need to worry about a blank box after the network URI is invalid.

(This solution does not seem to be compatible with all browsers. You can test the 360 speed and compatibility mode on your own, and display it normally in ie11)

2. Embed labels

<embed src="http://files.cnblogs.com/arthurymn/honehone_clock_wh.swf" />

<Embed> A tag is a new tag in HTML 5. Of course, it can only be displayed in HTML 5-enabled browsers. It is generally written as follows:

(Reference: http://www.cnblogs.com/wenyang-rio/archive/2013/01/05/2845973.html)

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="70" id="honehoneclock" align="middle"><param name="allowScriptAccess" value="always"><param name="movie" value="http://chabudai.sakura.ne.jp/blogparts/honehoneclock/honehone_clock_wh.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff"><param name="wmode" value="transparent"><embed wmode="transparent" src="http://chabudai.sakura.ne.jp/blogparts/honehoneclock/honehone_clock_wh.swf" quality="high" bgcolor="#ffffff" width="160" height="70" name="honehoneclock" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></object>

In this case, the objectobject is embedded with an embedtag, which improves the compatibility of the Code for various browser types. The HTML file can be properly displayed after being tried on all browsers in the current version. This is a great solution and is not the webpage code written by cainiao. However, a strange thing happened. After modification, click Save to go to "my blog" to see the effect. It didn't come out !!! Go back to the settings and find that the code in <embed/> has disappeared and tried several more times. The effect is the same. It seems that cnblogs is not very nice to see embed. It cannot be submitted, bug ...... as a result, there are 3rd solutions!

3. js dynamically writes HTML code

<script type="text/javascript">var swfTitle = "honehoneclock";var sUrl = "http://files.cnblogs.com/arthurymn/honehone_clock_wh.swf";var sHtml = "";sHtml += ‘<object width="200" height="75" data="http://files.cnblogs.com/arthurymn/honehone_clock_wh.swf" type="application/x-shockwave-flash">‘;sHtml += ‘<param name="src" value="http://files.cnblogs.com/arthurymn/honehone_clock_wh.swf" />‘;sHtml += ‘<embed wmode="transparent" src="‘ + sUrl + ‘" quality="high" bgcolor="#ffffff" width="160" height="70" name="‘ + swfTitle + ‘" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />‘;sHtml += ‘</object>‘;document.write(sHtml);</script>

In this way, both the object tag and the embed tag are processed as strings before document. Write. Click "save" in the settings and return "my blog". The settings are displayed successfully!

(Note: Before making JavaScript take effect, you need to send a message to the "blog community team" to apply for JS permissions for use. I sent a message with a try last night, I want to apply for Js. Today, I have passed the application. cnblogs is as efficient as ever. I would like to pay tribute to the spirit of High Efficiency !)

If you have any improper explanation, please correct me :)

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.