<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: html code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 07:35:49 GMT</pubDate>
    <description>DZone Snippets: html code</description>
    <item>
      <title>Firefox 3 and input file</title>
      <link>http://snippets.dzone.com/posts/show/5760</link>
      <description>The nsIDOMFile interface retrieves data from a file submitted to a form using the input type "file". This allows the file reference to be saved when the form is submitted while the user is using a web application offline, so that the data can be retrieved and uploaded once the Internet connection is restored.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;	&lt;title&gt;input type=file &amp; Firefox 3&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;	&lt;br /&gt;&lt;h1&gt;input type=file &amp; Firefox 3&lt;/h1&gt;&lt;br /&gt;	&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;// &lt;![CDATA[&lt;br /&gt;&lt;br /&gt;function inputFileOnChange() {&lt;br /&gt;	var v_console = '';&lt;br /&gt;	v_console += 'value: ' + document.getElementById('my-file').value;&lt;br /&gt;	v_console += '&lt;br \/&gt;';&lt;br /&gt;	&lt;br /&gt;	if(document.getElementById('my-file').files) {&lt;br /&gt;		// Support: nsIDOMFile, nsIDOMFileList&lt;br /&gt;		v_console += 'files.length: ' + document.getElementById('my-file').files.length;&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;		&lt;br /&gt;		v_console += 'fileName: ' + document.getElementById('my-file').files.item(0).fileName;&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;		&lt;br /&gt;		v_console += 'fileSize: ' + document.getElementById('my-file').files.item(0).fileSize;&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;		&lt;br /&gt;		v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsDataURL();&lt;br /&gt;//		v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsBinary();&lt;br /&gt;//		v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsText();&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;	};&lt;br /&gt;	&lt;br /&gt;	document.getElementById('console').innerHTML = v_console;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// ]]&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;	&lt;br /&gt;&lt;div&gt;&lt;br /&gt;	&lt;input type="file" name="my-file" id="my-file" onchange="inputFileOnChange();" /&gt;&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	&lt;code id="console"&gt;...console...&lt; /code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/plan-de-site/"&gt;Source: &lt;/a&gt;&lt;a href="http://www.ab-d.fr/date/2008-07-12/"&gt;Firefox 3 and input type=file , upload file&lt;/a&gt;</description>
      <pubDate>Sat, 12 Jul 2008 10:51:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5760</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Disable auto complete in input form</title>
      <link>http://snippets.dzone.com/posts/show/5642</link>
      <description>Disable auto complete in input form.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;&lt;br /&gt;window.onload = function() {&lt;br /&gt;	for(var i = 0, l = document.getElementsByTagName('input').length; i &lt; l; i++) {&lt;br /&gt;		if(document.getElementsByTagName('input').item(i).type == 'text') {&lt;br /&gt;			document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');&lt;br /&gt;		};&lt;br /&gt;	};&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;script&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr"&gt;Source AB-D: &lt;/a&gt;&lt;a href="http://www.ab-d.fr/date/2008-06-14/"&gt;Disable autocomplete in input type="text"&lt;/a&gt;</description>
      <pubDate>Fri, 13 Jun 2008 22:10:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5642</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Image Rotate with CANVAS</title>
      <link>http://snippets.dzone.com/posts/show/5514</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;	&lt;title&gt;rotate()&lt;/title&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;style type="text/css" media="screen"&gt;&lt;br /&gt;	img, canvas { border: 1px solid black; }&lt;br /&gt;	&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;&lt;br /&gt;function rotate(p_deg) {&lt;br /&gt;	if(document.getElementById('canvas')) {&lt;br /&gt;		/*&lt;br /&gt;		Ok!: Firefox 2, Safari 3, Opera 9.5b2&lt;br /&gt;		No: Opera 9.27&lt;br /&gt;		*/&lt;br /&gt;		var image = document.getElementById('image');&lt;br /&gt;		var canvas = document.getElementById('canvas');&lt;br /&gt;		var canvasContext = canvas.getContext('2d');&lt;br /&gt;		&lt;br /&gt;		switch(p_deg) {&lt;br /&gt;			default :&lt;br /&gt;			case 0 :&lt;br /&gt;				canvas.setAttribute('width', image.width);&lt;br /&gt;				canvas.setAttribute('height', image.height);&lt;br /&gt;				canvasContext.rotate(p_deg * Math.PI / 180);&lt;br /&gt;				canvasContext.drawImage(image, 0, 0);&lt;br /&gt;				break;&lt;br /&gt;			case 90 :&lt;br /&gt;				canvas.setAttribute('width', image.height);&lt;br /&gt;				canvas.setAttribute('height', image.width);&lt;br /&gt;				canvasContext.rotate(p_deg * Math.PI / 180);&lt;br /&gt;				canvasContext.drawImage(image, 0, -image.height);&lt;br /&gt;				break;&lt;br /&gt;			case 180 :&lt;br /&gt;				canvas.setAttribute('width', image.width);&lt;br /&gt;				canvas.setAttribute('height', image.height);&lt;br /&gt;				canvasContext.rotate(p_deg * Math.PI / 180);&lt;br /&gt;				canvasContext.drawImage(image, -image.width, -image.height);&lt;br /&gt;				break;&lt;br /&gt;			case 270 :&lt;br /&gt;			case -90 :&lt;br /&gt;				canvas.setAttribute('width', image.height);&lt;br /&gt;				canvas.setAttribute('height', image.width);&lt;br /&gt;				canvasContext.rotate(p_deg * Math.PI / 180);&lt;br /&gt;				canvasContext.drawImage(image, -image.width, 0);&lt;br /&gt;				break;&lt;br /&gt;		};&lt;br /&gt;		&lt;br /&gt;	} else {&lt;br /&gt;		/*&lt;br /&gt;		Ok!: MSIE 6 et 7&lt;br /&gt;		*/&lt;br /&gt;		var image = document.getElementById('image');&lt;br /&gt;		switch(p_deg) {&lt;br /&gt;			default :&lt;br /&gt;			case 0 :&lt;br /&gt;				image.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=0)';&lt;br /&gt;				break;&lt;br /&gt;			case 90 :&lt;br /&gt;				image.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1)';&lt;br /&gt;				break;&lt;br /&gt;			case 180 :&lt;br /&gt;				image.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=2)';&lt;br /&gt;				break;&lt;br /&gt;			case 270 :&lt;br /&gt;			case -90 :&lt;br /&gt;				image.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=3)';&lt;br /&gt;				break;&lt;br /&gt;		};&lt;br /&gt;		&lt;br /&gt;	};&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;window.onload = function() {&lt;br /&gt;	var image = document.getElementById('image');&lt;br /&gt;	var canvas = document.getElementById('canvas');&lt;br /&gt;	if(canvas.getContext) {&lt;br /&gt;		image.style.visibility = 'hidden';&lt;br /&gt;		image.style.position = 'absolute';&lt;br /&gt;	} else {&lt;br /&gt;		canvas.parentNode.removeChild(canvas);&lt;br /&gt;	};&lt;br /&gt;	&lt;br /&gt;	rotate(0);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;	rotate:&lt;br /&gt;	&lt;input type="button" value="0&#176;" onclick="rotate(0);" /&gt;&lt;br /&gt;	&lt;input type="button" value="90&#176;" onclick="rotate(90);" /&gt;&lt;br /&gt;	&lt;input type="button" value="180&#176;" onclick="rotate(180);" /&gt;&lt;br /&gt;	&lt;input type="button" value="-90&#176;" onclick="rotate(-90);" /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;	&lt;img id="image" src="http://www.google.com/intl/en_ALL/images/logo.gif" alt="" /&gt;&lt;br /&gt;	&lt;canvas id="canvas"&gt;&lt;/canvas&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr"&gt;Source: AB-D.fr&lt;/a&gt; - &lt;a href="http://www.ab-d.fr/date/2008-05-18/"&gt;Effectuer une rotation d'image en CSS ( rotate balise canvas HTML5 )&lt;/a&gt;</description>
      <pubDate>Sun, 18 May 2008 15:22:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5514</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Position : fixed in MSIE6</title>
      <link>http://snippets.dzone.com/posts/show/5132</link>
      <description>&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;title&gt;"position: fixed" compatible Microsoft Internet Explorer 6&lt;/title&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	&lt;!-- Code CSS for Firefox, Safari, Opera, Internet Explorer 7... --&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;style type="text/css" media="screen"&gt;&lt;br /&gt;		&lt;br /&gt;	#fixed {&lt;br /&gt;		position: fixed;&lt;br /&gt;		left: 0; top: 0; right: 0;&lt;br /&gt;		width: 100%;&lt;br /&gt;		padding: 10px; background: gray;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;/style&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	&lt;!-- Code CSS for Internet Explorer 6 --&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;!--[if lte IE 6]&gt;&lt;br /&gt;	&lt;style type="text/css" media="screen"&gt;&lt;br /&gt;	&lt;br /&gt;	#fixed {&lt;br /&gt;		position: absolute;&lt;br /&gt;		top: expression((document.documentElement.scrollTop || document.body.scrollTop) + this.offsetHeight - this.offsetHeight);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;/style&gt;&lt;br /&gt;	&lt;![endif]--&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;div id="fixed"&gt;DIV in position: fixed;&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: Asselin Benoit Developpement, conception de sites internet&lt;/a&gt;</description>
      <pubDate>Mon, 11 Feb 2008 20:39:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5132</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Make a variable CSS</title>
      <link>http://snippets.dzone.com/posts/show/5110</link>
      <description>Page.html&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;title&gt;Variable CSS&lt;/title&gt;&lt;br /&gt;	&lt;link rel="stylesheet" type="text/css" href="style.php" /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;Title&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="color-1"&gt; Text  Text  Text  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="color-2"&gt; Text  Text  Text  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="color-3"&gt; Text  Text  Text  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Style.php&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;header('Content-Type: text/css');&lt;br /&gt;&lt;br /&gt;$color_0 = '#000000';&lt;br /&gt;$color_1 = '#ff0000';&lt;br /&gt;$color_2 = '#ff3300';&lt;br /&gt;$color_3 = '#ff6600';&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;* { font-family: sans-serif; }&lt;br /&gt;&lt;br /&gt;h1 {&lt;br /&gt;	padding: 5px;&lt;br /&gt;	color: &lt;?= $color_0 ?&gt;;&lt;br /&gt;	border: 5px solid &lt;?= $color_2 ?&gt;;&lt;br /&gt;	background-color: &lt;?= $color_3 ?&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;p.color-1 { color: &lt;?= $color_1 ?&gt;; }&lt;br /&gt;p.color-2 { color: &lt;?= $color_2 ?&gt;; font-weight: bold; }&lt;br /&gt;p.color-3 { color: &lt;?= $color_3 ?&gt;; font-style: italic; }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr"&gt;Source: Asselin Benoit D&#233;veloppement, cr&#233;ation de site internet amiens&lt;/a&gt;</description>
      <pubDate>Wed, 06 Feb 2008 19:02:03 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5110</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>iPhone Orientation</title>
      <link>http://snippets.dzone.com/posts/show/4912</link>
      <description>iPhoneOrientation&lt;br /&gt;Demonstrates how to handle iPhone or iPod touch orientation events using HTML, CSS, and JavaScript.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;index.html&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;		&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;		&lt;meta name="viewport" content="width=device-width, user-scalable=no" /&gt;&lt;br /&gt;		&lt;title&gt;Handling iPhone or iPod touch Orientation Events&lt;/title&gt; &lt;br /&gt;		&lt;br /&gt;		&lt;!-- The iPhoneOrientation.css file is used to adjust the page appearance --&gt;&lt;br /&gt;		&lt;link rel="stylesheet" href="iPhoneOrientation.css" type="text/css" /&gt;&lt;br /&gt;		&lt;br /&gt;		&lt;!-- The iPhoneOrientation.js file shows how to handle iPhone orientation events --&gt;&lt;br /&gt;		&lt;script type="text/javascript" src="iPhoneOrientation.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body class="portrait"&gt;&lt;br /&gt;		&lt;!-- Display a message that describes the current iPhone orientation after rotation --&gt;&lt;br /&gt;		&lt;div id="currentOrientation"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;!-- The container div is made of two inner divs: leftContainer and rightContainer. The leftContainer and rightContainer are stacked&lt;br /&gt;				 up one above the other when iPhone is in portrait orientation and side by side when iPhone is in landscape orientation --&gt;&lt;br /&gt;		&lt;div id="container"&gt;&lt;br /&gt;			&lt;!--The button class is used to build a rounded rectangle around each text --&gt;&lt;br /&gt;			&lt;!--The page appearance changes whenever iPhone rotates between portrait and landscape display views --&gt;&lt;br /&gt;			&lt;div id="leftContainer"&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/DebuggingSafarioniPhoneContent/chapter_10_section_1.html'"&gt;Debug Console&lt;/div&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/chapter_4_section_8.html'"&gt;Viewport Settings&lt;/div&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;			&lt;div id="rightContainer"&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/AdjustingtheTextSize/chapter_5_section_4.html'"&gt;Highlighting Elements&lt;/div&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/DesigningForms/chapter_7_section_1.html'"&gt;Form Auto Correction&lt;/div&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;iPhoneOrientation.css&lt;br /&gt;&lt;code&gt;&lt;br /&gt;body &lt;br /&gt;{&lt;br /&gt;		margin: 0px;&lt;br /&gt;		padding: 0px;&lt;br /&gt;		font-size: 12px;&lt;br /&gt;		font-family: 'Lucida Grande', Verdana, sans-serif;&lt;br /&gt;		font-weight: bold;&lt;br /&gt;		/* Turn off font resizing */&lt;br /&gt;		-webkit-text-size-adjust: none;   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set the background color of the page when the body tag's class attribute is equal to portrait. &lt;br /&gt;   The expression body[class="value"] is a CSS attribute selector where "body" is the html element to be styled, "class" the body's attribute to be&lt;br /&gt;   manipulated, and "value" the class attribute's value, which is either portrait, landscapeLeft, or landscapeRight.&lt;br /&gt;   This expression is used to dynamically select a body style according to the class attribute value. For instance, if the body's class attribute is set&lt;br /&gt;   to landscapeLeft, then all style declarations matching body[class="landscapeLeft"] will be used to style "Handling iPhone or iPod touch Orientation Events". &lt;br /&gt;   The JavaScript updateOrientation function in the iPhoneOrientation.js file is used to set the body's class attribute to one of these values.&lt;br /&gt;   Further information about CSS attribute selectors can be found at  http://www.w3.org/TR/css3-selectors/#attribute-selectors.&lt;br /&gt; */&lt;br /&gt;body[class="portrait"] &lt;br /&gt;{&lt;br /&gt;		background: white;    	&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Adjust a button when the body's class attribute is equal to portrait */&lt;br /&gt;body[class="portrait"] .button    &lt;br /&gt;{	&lt;br /&gt;		background: white;&lt;br /&gt;		width: 210px;&lt;br /&gt;		height: 13px;&lt;br /&gt;		&lt;br /&gt;		padding: 10px 0px;&lt;br /&gt;		margin: 10px auto;&lt;br /&gt;		&lt;br /&gt;		font-size: 15px;&lt;br /&gt;		&lt;br /&gt;		/* text is black on the button */&lt;br /&gt;		color: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The leftContainer and rightContainer div elements are stacked up one after the other when the body's class attribute is equal to portrait. &lt;br /&gt;   They are both 200 pixels wide. */&lt;br /&gt;body[class="portrait"] #leftContainer&lt;br /&gt;{&lt;br /&gt;		width: 200px;&lt;br /&gt;		margin: auto auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;body[class="portrait"] #rightContainer&lt;br /&gt;{&lt;br /&gt;		width: 200px;&lt;br /&gt;		margin: auto auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set the background color of the page when the body's class attribute is set to landscapeLeft */&lt;br /&gt;body[class="landscapeLeft"] &lt;br /&gt;{&lt;br /&gt;		background: lightgrey;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Adjust a button when the body's class attribute is set to landscapeLeft */&lt;br /&gt;body[class="landscapeLeft"] .button  &lt;br /&gt;{&lt;br /&gt;		background: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The container div is evenly split between leftContainer and rightContainer when the body's class attribute is set to landscapeLeft.&lt;br /&gt;   leftContainer and rightContainer are stacked side by side. leftContainer aligns buttons to the left side of the page; &lt;br /&gt;   rightContainer aligns buttons to the right side of the page. */&lt;br /&gt;body[class="landscapeLeft"] #leftContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		/* Align the div to the left of the page  */&lt;br /&gt;		float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;body[class="landscapeLeft"] #rightContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		/* Align the div to the right of the page  */&lt;br /&gt;		float: right;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set the background color of the page when the body's class attribute is equal to landscapeRight */&lt;br /&gt;body[class="landscapeRight"] &lt;br /&gt;{&lt;br /&gt;		background: tan;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Adjust a button when the body's class attribute is equal to landscapeRight */&lt;br /&gt;body[class="landscapeRight"] .button  &lt;br /&gt;{&lt;br /&gt;		background: darkred;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The container div is evenly split between leftContainer and rightContainer when the body's class attribute is set to landscapeRight.&lt;br /&gt;   leftContainer aligns buttons to the left side of the page; rightContainer aligns buttons to the right side of the page. */&lt;br /&gt;body[class="landscapeRight"] #leftContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body[class="landscapeRight"] #rightContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		float: right;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Draw a rounded rectangle around a text */&lt;br /&gt; .button    &lt;br /&gt;{&lt;br /&gt;		font-weight: bold;&lt;br /&gt;		text-align: center;&lt;br /&gt;		&lt;br /&gt;		width: 130px;&lt;br /&gt;		height: 13px;&lt;br /&gt;		font-size: 10px;&lt;br /&gt;		&lt;br /&gt;		/* text is white on the button */&lt;br /&gt;		color: white;	&lt;br /&gt;	&lt;br /&gt;		/* Draw a rectangle around a text */&lt;br /&gt;		border: 1px solid black;    &lt;br /&gt;		&lt;br /&gt;		/* Round each corner of the generated rectangle */&lt;br /&gt;		-webkit-border-radius: 5px;   &lt;br /&gt;		padding: 5px 0px;&lt;br /&gt;		margin: 5px auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Defines styling properties for the currentOrientation div, which shows a message that indicates iPhone's current orientation after rotation */&lt;br /&gt;#currentOrientation&lt;br /&gt;{		&lt;br /&gt;		width: 280px;&lt;br /&gt;		text-align: center;&lt;br /&gt;		margin: 10px auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;a&lt;br /&gt;{&lt;br /&gt;		text-decoration: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The container div contains four buttons that are evenly divided between the inner leftContainer and rightContainer div elements.&lt;br /&gt;   Its width does not change when iPhone switches between portrait and landscape orientations. */&lt;br /&gt;#container&lt;br /&gt;{&lt;br /&gt;		/* fixed width across all iPhone orientation changes */&lt;br /&gt;		width: 300px;&lt;br /&gt;		margin: 10px auto;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;iPhoneOrientation.js&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* updateOrientation checks the current orientation, sets the body's class attribute to portrait, landscapeLeft, or landscapeRight, &lt;br /&gt;   and displays a descriptive message on "Handling iPhone or iPod touch Orientation Events".  */&lt;br /&gt;function updateOrientation()&lt;br /&gt;{&lt;br /&gt;	/*window.orientation returns a value that indicates whether iPhone is in portrait mode, landscape mode with the screen turned to the&lt;br /&gt;	  left, or landscape mode with the screen turned to the right. */&lt;br /&gt;	var orientation=window.orientation;&lt;br /&gt;	switch(orientation)&lt;br /&gt;	{&lt;br /&gt;	&lt;br /&gt;		case 0:&lt;br /&gt;				/* If in portrait mode, sets the body's class attribute to portrait. Consequently, all style definitions matching the body[class="portrait"] declaration&lt;br /&gt;				   in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */&lt;br /&gt;				document.body.setAttribute("class","portrait");&lt;br /&gt;				&lt;br /&gt;				/* Add a descriptive message on "Handling iPhone or iPod touch Orientation Events"  */&lt;br /&gt;				document.getElementById("currentOrientation").innerHTML="Now in portrait orientation (Home button on the bottom).";&lt;br /&gt;				break;	&lt;br /&gt;				&lt;br /&gt;		case 90:&lt;br /&gt;				/* If in landscape mode with the screen turned to the left, sets the body's class attribute to landscapeLeft. In this case, all style definitions matching the&lt;br /&gt;				   body[class="landscapeLeft"] declaration in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */&lt;br /&gt;				document.body.setAttribute("class","landscapeLeft");&lt;br /&gt;				&lt;br /&gt;				document.getElementById("currentOrientation").innerHTML="Now in landscape orientation and turned to the left (Home button to the right).";&lt;br /&gt;				break;&lt;br /&gt;		&lt;br /&gt;		case -90:	&lt;br /&gt;				/* If in landscape mode with the screen turned to the right, sets the body's class attribute to landscapeRight. Here, all style definitions matching the &lt;br /&gt;				   body[class="landscapeRight"] declaration in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */&lt;br /&gt;				document.body.setAttribute("class","landscapeRight");&lt;br /&gt;				&lt;br /&gt;				document.getElementById("currentOrientation").innerHTML="Now in landscape orientation and turned to the right (Home button to the left).";&lt;br /&gt;				break;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Point to the updateOrientation function when iPhone switches between portrait and landscape modes.&lt;br /&gt;window.onorientationchange=updateOrientation;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Source: http://developer.apple.com/samplecode/iPhone/idxSafari-date.html&lt;br /&gt;( &lt;a href="http://www.ab-d.fr/"&gt;AB-D&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Sat, 22 Dec 2007 12:53:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4912</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>How to detect a browser iPhone ?</title>
      <link>http://snippets.dzone.com/posts/show/4826</link>
      <description>The browser is :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;Mozilla/5.0 (iPhone; U; CPU like Mac OS X; fr) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: ab-d.fr&lt;br /&gt;Internet with iPhone&lt;br /&gt;&lt;/a&gt;</description>
      <pubDate>Thu, 29 Nov 2007 10:34:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4826</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
  </channel>
</rss>
