Iphone redirection
February 14th, 2010if(navigator.userAgent.match(/iPhone/i)){
// iPhone redirect?
}
| programmershelp.co.uk |
| Javascript Resources |
if(navigator.userAgent.match(/iPhone/i)){
// iPhone redirect?
}
function uniqeid()
{
var newDate = new Date;
return newDate.getTime();
}
<!– Copy this code into the BODY section –>
<SCRIPT LANGUAGE="JavaScript1.2">
<!– Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
// End –>
</SCRIPT>
</CENTER>
<!– Paste this into the HEAD of your HTML document –>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!– Original: Michael Hundt (mchundt@nglic.com) –>
<!– Web Site: http://www.cinet.net/~mhundt/mystuff.htm –>
<! >
<! >
<!– Begin
function doArea(num) {
switch(num) {
case 0 : return (""); break;
case 1 : var length = prompt("Please enter the length of your square:", "");
length = length * length;
return (length); break;
case 2 : var width = prompt("Please enter the width of the base:", "");
var height = prompt("Please enter the height of the triangle:", "");
return (width * height / 2); break;
case 3 : var width = prompt("Please enter the width of your rectangle:", "");
var height = prompt("Please enter the height of your rectangle:", "");
return (width * height); break;
case 4 : var radius = prompt("Please enter the radius of the circle: ", "");
return (Math.PI * Math.pow(radius, 2)); break;
case 5 : var radius = prompt("Please enter the radious of the sphere:", 0);
return (4 * Math.PI * (Math.pow(radius, 2))); break;
}
}
// End –>
</script>
</HEAD>
<!– Copy this into the BODY of your HTML document –>
<center>
<form name=calcarea>
Find the area of a
<select name="shape" size="1" onChange="this.form.area.value = doArea(this.selectedIndex);">
<option> …
<option value="square">Square
<option value="triangle">Triangle
<option value="rectangle">Rectangle
<option value="circle">Circle
<option value="sphere">Sphere
</select>
= <input type=text name=area size=10>
</form>
</center>
1: <!-- STEP ONE: Copy this code into the BODY of your HTML document -->
2:
3: Enter a number in either field, then click outside the text box.
4:
5: <form>
6: F:
7: <input type="text" name="F" value="32"
8: onChange="C.value = 100/(212-32) * (this.value - 32 )"><br>
9: C:
10: <input type="text" name="C" value="0"
11: onChange="F.value = (212-32)/100 * this.value + 32 "><br>
12: </form>