藍天浮雲

This is our world… Nothing changes. It’s here, that we are going to live on…

Archive for the ‘XHTML’ Category

手快殘廢了

有2則留言

專題研究輪站課程結束了,下學期組別也都選好了,我選了資訊。除了地科只有 9 個人以外,其他人數都很平均。下星期就要考專題研究的期末考了,得好好準備一下。若不及格會被踢出數理班。不過這次考試應該不會太難,資訊、數學都有發題庫練習。考完專研又有期末考,打算用連假把書念一念。

今天晚上花了一堆時間修圖書館的網頁,因為實在太慢了。原始碼根本不堪入目,圖檔也沒壓好。一堆標籤亂用(特別是 <font>),CSS 幾乎沒有用到,很可惜。經過一番整頓候,網頁小很多,而且還變成合格的 HTML 4.01 Transitional。還有很多地方可以用 CSS 取代,但懶得弄了。現在打 code 打到手快殘廢了,累死人了。

用 Apache 的 mod_deflate(或 mod_gzip) 壓縮檔案會使網頁的大小縮很多,有時候甚至可以少掉 50%,但似乎很少人在用。這次網頁的大小就從 33 KB 壓到 6 KB。還有 PNG 圖檔通常比 GIF 小,所以很多網頁已經開始轉向使用 PNG 了。而且 GIF 其實有版權,所以市面上可以製作 GIF 檔的軟體都含有用費用,不過一般人不會注意。

最近終於將討論區弄好,但怎麼都沒人去啊?我弄得很辛苦!!!

作者為dennylin93

2008/12/31 at 9:21 下午

Embedding Flash

有一則留言

Ever since Alex and I started using valid code for websites, we have been searching for a way to embed Flash properly. The most common way we see is probably the built-in method in Dreamweaver.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash">
<param name="movie" value="../media/Flash.swf" />
<param name="quality" value="high" />
<embed src="./file.swf" quality="high" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed>
</object>

In this code, different elements are used for different browsers. <object> is used for Internet Explorer while <embed> is used by other browsers. IE recognizes <object> and uses it to display Flash, however, other browsers do not, so they ignore it and move on to use <embed> as an alternative.

Because <embed> was created by Netscape and is not part of the HTML specification, it will make your page invalid. Moreover, this method will not allow you to put any alternative text or images if the Flash fails to load.

After some time on the Internet, we found an effective method of embedding Flash (on this site) that supports all the major browsers we know of.

<!--[if IE]>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash">
< ![endif]-->
<!--[if !IE]> < -->
</object><object type="application/x-shockwave-flash" data="./file.swf" width="550" height="400" title="Flash">
<!--> < ![endif]-->
<param name="movie" value="./file.swf" />
<param name="quality" value="high" />
<param name="pluginurl" value="http://www.adobe.com/go/getflashplayer" />
</object>

This method uses conditional comments, therefore, it can work on multiple browsers while having the same functions as the method used by Dreamweaver. The start of <object> was specifically meant for IE, so it is between <!--[if IE]> and <![endif]-->. Another variation of <object> for other browsers such as Mozilla Firefox is between <!--[if !IE]> <--> and <!--> <![endif]-->.

Another problem we have been trying to solve is we have to click on Flash objects in IE to activate them. It’s quite annoying, so we decided to get rid of it once and for all. We simply created a JavaScript file and included either the original or valid code by using document.write and added allowScriptAccess.

document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash"><param name="movie" value="./file.swf" /><param name="quality" value="high" /><param name="allowScriptAccess" value="always" /><embed src="./file.swf" quality="high" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="always" width="550" height="400"></embed></object>');

Now the XHTML code is:
<script src="../scripts/Flash.js" type="text/javascript"></script>

Although JavaScript works in most browsers, some people prefer to block JavaScript, for it may be obtrusive. Therefore, we added the valid code within <noscript>:

<script src="../scripts/Flash.js" type="text/javascript"></script>
<noscript>
<div>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0" width="550" height="400" title="Flash">
< ![endif]-->
<!--[if !IE]> < -->
</object><object type="application/x-shockwave-flash" data="./file.swf" width="550" height="400" title="Flash">
<!--> < ![endif]-->
<param name="movie" value="./file.swf" />
<param name="quality" value="high" />
<param name="pluginurl" value="http://www.adobe.com/go/getflashplayer" />
</object>
</div>
</noscript>

So far this code has worked well although editing things inside is tedious. Right now, I don’t know if Flash embedded this way will stream properly. Apart from this, I don’t think there will be any other problems.

Note:

  • <script> shouldn’t be placed within <p>, or else your page won’t validate.

Links:

作者為dennylin93

2007/06/02 at 7:55 下午

A new site or another failure?

沒有留言

After I found some excellent templates on Thursday, I decided to start making my own website. I used to spend all my time on the class web, so I couldn’t make one for myself. I hope I can complete my site since I gave up on my previous try.

作者為dennylin93

2007/02/10 at 8:19 下午

Great templates

有2則留言

While I was surfing the Net, I came to http://andreasviklund.com/, and I saw some awesome and free templates. They are great for beginners because the templates are all valid XHTML and CSS, and they are completely free. WordPress themes are also available.

作者為dennylin93

2007/02/08 at 5:56 下午

A new beginning

沒有留言

I’ve been waiting ages for the winter break so I can start on a new website. I tried converting the class web to XHTML 1.0 Strict to improve my skills with XHTML, but I had difficulties, so I didn’t manage to convert them all. After learning a lot about XHTML and CSS in the past few months, I decided it is time to move on and start making a new website.

作者為dennylin93

2007/01/25 at 7:08 下午

Making a website

沒有留言

Although it sounds simple, it is a complex job. It is time-consuming, yet it is still worth it. Making the class web is tiring, but it should be pretty good when it is completed. Learning Flash would probably be one of the hardest things to do since it is the first time I have tried to create a website with it. Debugging will also a bit hard, since we are trying to meet the W3C standards. Embedding Flash was a major problem since the <embed> tag wasn’t valid HTML/XHTML. In the end, we had to search for one, and we managed doing it.

作者為dennylin93

2006/10/23 at 9:09 下午