Archive for category html

Automatically Putting the Cursor in a Field when its load

This page demonstrates a technique for automatically putting the cursor into an input field as soon the page is loaded.
Let’s suppose you want the user to go directly to the following form. Notice that we set the names for the form and the field.

<FORM NAME="MyForm" ACTION="action.html">
name: <INPUT NAME="realname"><BR>
email: <INPUT NAME="email"><BR>
</FORM>

We can set the focus immediately by adding an onLoad attribute to the tag. Notice that the word focus must be followed by open and close parentheses: ():

<BODY onLoad="document.forms.MyForm.realname.focus()">

source: http://www.htmlcodetutorial.com

Leave a comment

Resize & Crop Image using CSS

buat div dimana tempat image akan di tampilkan/display:

.img-div{
	width:155px; 
	height:146px; 
	float:left; 
	display:block; 
	overflow:hidden; 
	position:relative;
}

crop image agar sesuai dengan ukuran div yg telah dibuat diatas:

.img-crop{
    max-height: 146px;
    min-width: 155px;
    position: relative;
    top: 0;
}

applying ke html:

<div id="img-div">
	<img class="img-crop" src="images/fileimage.jpg">
</div>

Leave a comment

Membuat halaman iframe


berikut adalah contoh membuat iframe dibantu dengan menggunakan script php:
-buat 3 file halaman html untuk di load di dalam iframe (misalkan. hal1.html, hal2.html dan hal3.html)
-buat halaman index.php, dimana tempat untuk load halaman tersebut diatas.

file index.php :

<?
$Q = $_REQUEST["page"];

	if($Q == ""){$pager = "hal1.html";} //ini halaman pertama yg di load iframe
	else{$pager = "hal" . $Q . ".html";}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<a href="index.php?page=1" name="1" >Halaman 1</a> | <a href="index.php?page=2" name="2">Halaman 2</a> | <a href="index.php?page=3" name="3">Halaman 3</a><br /><br />
<iframe style="width:600px; height:300px; margin:0px auto" src="<? echo $pager;?>" ></iframe>
</body>
</html>

Leave a comment

Design a site like this with WordPress.com
Get started