Automatically choose stylesheet file with users' browser

As being web-developer, we need to consider our websites must be compatible with every browsers. When I was lack of experiences in Web Developement, some of my websites are ok with only Internet Explorer. In firefox or Opera, the structure of my websites are distortion and awful. That's why I need to do all of my site to be compatible with all browsers whenever I start creating. And, need to do our site can choose appropriate stylesheet up to users' browser. Because we cannot do only one stylesheet file can be compatible to every browser. Here is coding:

view plain print about
1<!--- (For Internet Browser) --->
2<!--[if IE]>
3<link rel="stylesheet" type="text/css" href="ie_styles.css">
4<![endif]-->

5(For Chrome, firefox so on)
6<!--<![if !IE]>
7<link rel="stylesheet" type="text/css" href="ff_styles.css">
8<![endif]>-->

Embedding windows media player WMV

I'm now creating misspeople2008 section for www.people.com.mm. In these days, I need to do one video file into index page. First of all, I was thinking about how about embed flv player into my site. But, it's problem that my server hasn't installed Flash Player Server. That's why I decided to use with window media player. Blow is coding how to embed Video Player in HTML Page.

view plain print about
1<invalidTag
2     id="MediaPlayer"
3    width=253
4    height=204
5    classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
6    standby="Loading Windows Media Player components..."
7    type="application/x-oleobject"
8    codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">

9     <param name="filename" value="URL File">
10     <param name="Showcontrols" value="True">
11     <param name="autoStart" value="True">
12     <invalidTag
13         type="application/x-mplayer2"
14        src="URL File"
15        name="MediaPlayer"
16        width=253
17        height=204>
</embed>
18 </object>

How? It's easy, isn't it?

ppshein is on Connect Tech Fashion Journal

Last week, one of the editor of Connect journal request me to interview me about how to create web development and feeling of being web developer for awhile. In this interview, I've answered about the current IT situation in Myanmar, Web development and web developers. 

  • Which kinda of websites are popular in Myanmar.
  • Which kinda of web based languages are popular in Myanmar.
  • And how to prevent our websites not to be attacked by SQL injection and so on.

How to create Captcha in ASP.NET

 

In these days, our programmers need to create a simple customer feedback form for our client. As we all know, it's quite simple to do. But, to have good security for our site, we should prevent any spam in advance. That's why how to put Image Captcha in our site. I found following site.

Big Credit to : http://johnadonline.com/?tag=how-to-create-captcha-in-aspnet-c

Transparent PNG Image in Internet Explorer

Some designers might say PNG image type is the best in Web Development. Because it has good resolution, less file size and so on than JPEG. But it's a problem that its background cannot be transparent in Internet Explorer like Gif format. And, we cannot do it can be transparent with CSS coding. But, don't worry. I can point out how to make PNG image background to be transparent in Internet Explorer.

iepngfix.htc

view plain print about
1<public:component>
2<public:attach event="onpropertychange" onevent="doFix()" />
3<invalidTag type="text/javascript">
4// IE5.5+ PNG Alpha Fix v1.0RC4
5// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
6// This is licensed under the CC-GNU LGPL, version 2.1 or later.
7// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
8// This must be a path to a blank image. That's all the configuration you need.
9if (typeof blankImg == 'undefined') var blankImg = '[root]/blank.gif';
10var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
11function filt(s, m)
12{
13�if (filters[f])
14{
15��filters[f].enabled = s ? true : false;
16��if (s) with (filters[f]) { src = s; sizingMethod = m }
17}
18�else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
19}
20function doFix()
21{
22�// Assume IE7 is OK.
23�if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) ||
24��(event &amp;&amp; !/(background|src)/.test(event.propertyName))) return;
25�var bgImg = currentStyle.backgroundImage || style.backgroundImage;
26�if (tagName == 'IMG')
27{
28��if ((/\.png$/i).test(src))
29��{
30�� if (currentStyle.width == 'auto' &amp;&amp; currentStyle.height == 'auto')
31�� �style.width = offsetWidth + 'px';
32�� filt(src, 'scale');
33�� src = blankImg;
34��}
35��else if (src.indexOf(blankImg) < 0) filt();
36}
37�else if (bgImg &amp;&amp; bgImg != 'none')
38{
39��if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i))
40��{
41�� var s = RegExp.$1;
42�� if (currentStyle.width == 'auto' &amp;&amp; currentStyle.height == 'auto')
43�� �style.width = offsetWidth + 'px';
44�� style.backgroundImage = 'none';
45�� filt(s, 'crop');
46�� // IE link fix.
47�� for (var n = 0; n < childNodes.length; n++)
48�� �if (childNodes[n].style) childNodes[n].style.position = 'relative';
49��}
50��else filt();
51}
52}
53doFix();
54</script>
55</public:component>
56
57
And, you must put blank.gif image into your root. To include above file in stylesheet.css like that :
view plain print about
1span#logo img {behavior: url("iepngfix.htc");}
2
3
How.?? It's easy, isn't it?

Check browser type with Javascript

Above post, I've describe how to choose appropriate stylesheet with HTML tag. In this post, I'll describe how to check users' browser type and how to choose appropriate stylesheet with javascript. Here is coding:

view plain print about
1var browser � � = '';
2var version � � = '';
3var entrance � �= '';
4var cond � � � �= '';
5// BROWSER?
6if (browser == ''){
7if (navigator.appName.indexOf('Microsoft') != -1)
8browser = 'IE'
9else if (navigator.appName.indexOf('Netscape') != -1)
10browser = 'Firefox'
11else browser = 'IE';
12}
13if (version == ''){
14version= navigator.appVersion;
15paren = version.indexOf('(');
16whole_version = navigator.appVersion.substring(0,paren-1);
17version � � � � = parseInt(whole_version);
18}
19if (browser == 'IE' &amp;&amp; version >
= 4) document.write('<'+'link rel="stylesheet" href="css/ie_styles.css" />');
20if (browser == 'Firefox' &amp;&amp; version >= 2.02) document.write('<'+'link rel="stylesheet" href="css/ff_styles.css" />');

Random Image Rotator

I was kinda busy in these days about creating misspeople page of myanmar people magazine. In this page, we need to show our client adversitements as rotator. Do you know how to rotate ADS?

view plain print about
1<invalidTag LANGUAGE="JavaScript">
2var interval = 2.5; // delay between rotating images (in seconds)
3var random_display = 1; // 0 = no, 1 = yes
4interval *= 1000;
5
6 var image_index = 0;
7image_list = new Array();
8image_list[image_index++] = new imageItem("01.jpg");
9image_list[image_index++] = new imageItem("02.jpg");
10var number_of_image = image_list.length;
11function imageItem(image_location) {
12this.image_item = new Image();
13this.image_item.src = image_location;
14}
15
16function get_ImageItemLocation(imageObj) {
17return(imageObj.image_item.src)
18}
19
20function generate(x, y) {
21var range = y - x + 1;
22return Math.floor(Math.random() * range) + x;
23}
24
25function getNextImage() {
26if (random_display) {
27image_index = generate(0, number_of_image-1);
28}
29else {
30image_index = (image_index+1) % number_of_image;
31}
32
33var new_image = get_ImageItemLocation(image_list[image_index]);
34return(new_image);
35}
36
37function rotateImage(place) {
38var new_image = getNextImage();
39document[place].src = new_image;
40var recur_call = "rotateImage('"+place+"')";
41setTimeout(recur_call, interval);
42}
43// End -->

44
45</script>
46</HEAD>
47
48<center>
49<img name="rImage" src="01.jpg" width=120 height=90>
50</center>
51
52<invalidTag>
53<!--
54rotateImage('rImage')?
55 -->

56</script>

Printable version with CSS Stylesheet

Our new project is to output data with table grid view. In this project, users can view how their data will be output in printable version by clicking Print View button of our browser without reloading current page. I was in dilemma because of this problem and solving how to fulfill our customers' demand. Fortunately, I can solve this problem in short time. Here is coding:

view plain print about
1<link rel="stylesheet" type="text/css" media="screen" href="styles/screen.css" /> (for screen)
2
3<link rel="stylesheet" type="text/css" media="print" href="styles/print.css" /> (for print)

If you want to do like that, you must have 2 seperate stylesheet like screen.css and print.css. Ok, write into them what you want to create your stylesheet design.

Chrome browser is out

Google release their browser called "Chrome" today. As Google style, we must have internet if we want to install Chrome browser. Any offline users cannot install it. Honestly, GUI is really cool and screen size is more wide than FireFox and IE. But, I haven't tested the security of Chrome yet.

Download : http://www.freechromethemes.com/DownloadGoogleChrome.php

Google Page Creator is no longer accepting new sign-ups

We are no longer accepting new sign-ups for Page Creator because we have shifted our focus to developing Google Sites, which offers many of the capabilities of Page Creator along with new features like site-level navigation, site-level headers, control over who can see and edit your site, and rich embeddings like calendars, videos, and Google docs.

If you are currently a Page Creator user, you can continue to use Page Creator and your pages will automatically be transitioned to Google Sites later this year. We are committed to making this transition as smooth and easy as possible, and we will post more details as we get closer to the transition time. You can also manually move your web pages from Page Creator to Google Sites or other service providers at any time.

Top of Page