001.dk

Denne side bruges til forsøg med [CSS] & [JavaScript] & [DHTML] & [PHP] i forbindelse med undervisning.


PHP Charset set with header

header('Content-type: text/html; charset=iso-8859-1')

PHP STOP

break; exit;

Regular Expression

src='[^']*' eller src="[^"]*"

Flash med mulighed for div-overlay

function flashFilm(url,width,height){ fl='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="'+height+'" width="'+width+'">'; fl+='<param name="movie" value="'+url+'">'; fl+='<param name="quality" value="best">'; fl+='<param name="play" value="true">'; fl+='<param name="wmode" value="transparent">'; fl+='<embed height="'+height+'" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+url+'" type="application/x-shockwave-flash" width="'+width+'" wmode="transparent" quality="best" play="true">'; fl+='</object>'; document.write(fl); }

HTML5 JavaScript til IE

<!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"> </script> <![endif]-->

CSS font

li { font-variant: small-caps; } li:first-letter { text-transform: uppercase; } h1 { text-transform: capitalize; }

IE 8 Compatibility Meta Tag

<meta http-equiv="X-UA-Compatible" content="IE=8" /> <meta http-equiv="X-UA-Compatible" content="chrome=1">

CSS: Fjern stiblet linie fra aktive link:

a {outline: none;}

Sæt default scrollbar:

I sidens stylesheet: body {overflow-y: scroll;} <!--[if lte IE 7]> <style type="text/css" /> body { overflow-y: auto; } </style> <![endif]--> gt =greater than gte =greater than or equal lt =lower than lte =lower or equal
{ style="white-space: nowrap;" }    Phasellus lectus nibh, sagittis eget, tincidunt eget, volutpat eget, elit. Aenean ut nisl. Quisque urna enim, sodales quis, vulputate id, lobortis porttitor, quam. Vestibulum ut felis eget est dictum eleifend. Cras blandit interdum diam. Maecenas eros. Suspendisse a diam sit amet sem placerat sodales. Curabitur quis lorem et massa egestas tempus. Aenean libero est, varius sed, rutrum id, suscipit eget, magna. Proin vehicula arcu nec magna. Nullam ac quam ut pede fringilla feugiat.

PHP :: SQL :: JQuery Løkker, Hvis, Tid & Strenge

Hent JQuery:

OnLoad JQuery:

JQuery noConflict():

JQuery noConflict() - 2:

HTML5 i IE < 9 - Modernizr:

HTML5 i IE < 9 - HTML5shiv:

Database connection:

SELECT:

INSERT:

DELETE:

UPDATE:

SELECT - LIKE:

Doctype XHTML:

Meta tag - robots:

Fav icon:

Dummy images:

HTML5-skabelon:

CSS-skabelon:

Clearfix

Mark of the Web:

PHP - Redirect permanently:

HTML & CSS Validering:

Foreach på $_SERVER

foreach ($_SERVER as $key => $value) {
		echo $key . " = " . $value . "<br>";
}

Txt to Ashii (HTML)

function ashii($string){
	$asciiString = "";
	for($i = 0; $i != strlen($string); $i++){
		$asciiString .= "&#".ord($string[$i]).";";
	}
	return $asciiString;
}

For-løkke

for($i = 1 ; $i <= 10 ; $i++){
	echo $i;
}

While-løkke

$i = 1;
while($i <= 10){
	echo $i;
	$i++;
}

Foreach

foreach ($array as $key => $value) { echo $key . " = " . $value . "<br />"; }

If

if($tal == 8) {
	$res = 10 * $tal;
}
	

If foranstillet 0

$res = ($tal <= 9) ? "0".$tal : $tal;
	

If - else

if($tal == 2) {
	$res = 1;
}else{
	$res = 2;
}

$res = $tal == 2 ? 1 : 2;

Switch-case

switch ($bogstav) {
	case "a" :
		$res = 1;
		break;
	
	case "b" :
		$res = 2;
		break;
	
	default :
		$res = 3;
		break;
}

Get the remote address

function getIp() {
    $ip = $_SERVER['REMOTE_ADDR'];
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    	$ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    	$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    return $ip;
}

Date - Time - MkTime

  • $idag = date('d-m-Y');
  • $tidsstempel = time();
  • $dag = date('d-m-Y',$tidsstempel);
  • $maketime = mktime('0','0','0','11','28','2009');
  •  
  • if(is_numeric($tal)){}

Login password:


07-12-2016