You are on page 1of 3

Nama : Rizwan Purwanta

Kelas: 05 PKM
NIM : 1200943253

1.-DHTML Event Model adalah event yang dapat digunakan untuk memicu javascript y
ang bisa memanipulasi objek pada dokumen.
-penggunaanya : dapat mengandung konten yang dapat berubah sesuai dengan interak
si user atau waktu.

2.-Onmousemove
<html>
<head>
<title>onmousemove example</title>
<script type = "text/javascript">
function updateMouseCoordinates()
{
coordinates.innerText =
event.srcElement.tagName +
" (" + event.offsetX + ", " +
event.offsetY + ")";
}
</script>
</head>
<body onmousemove = "updateMouseCoordinates()">
<span id = "coordinates">(0, 0)</span><br>
<img src = "ellipse.bmp"
style ="position: absolute; top: 100;
left: 100">
</body>
</html>

- onmouseover dan onmouseout


<html>
<head>
<title>
DHTML Event Model - onmouseover and onmouseout
</title>
<script type = "text/javascript">
<!--
captionImage1 = new Image();
captionImage1.src = "caption1.gif";
captionImage2 = new Image();
captionImage2.src = "caption2.gif";
function mOver()
{
if ( event.srcElement.id == "tableCaption" ) {
event.srcElement.src = captionImage2.src;
return;
}
// If the element which triggered onmouseover has
// an id, change its color to its id.
if ( event.srcElement.id )
event.srcElement.style.color =
event.srcElement.id;
}
function mOut()
{
if ( event.srcElement.id == "tableCaption" ) {
event.srcElement.src = captionImage1.src;
return;
}
// If it has an id, change the text inside to the
// text of the id.
if ( event.srcElement.id )
event.srcElement.innerText = event.srcElement.id;
}
document.onmouseover = mOver;
document.onmouseout = mOut;
// -->
</script>
</head>
<body style = "background-color: wheat">
<h1>Guess the Hex Code's Actual Color</h1>
<p>Can you tell a color from its hexadecimal RGB code
value? Look at the hex code, guess the color. To see
what color it corresponds to, move the mouse over the
hex code. Moving the mouse out will display the color
name.</p>
<table style = "width: 50%; border-style: groove;
text-align: center; font-family: monospace;
font-weight: bold">

<caption>
<img src = "caption1.gif" id = "tableCaption"
alt = "Table Caption" />
</caption>
<tr>
<td><a id = "Black">#000000</a></td>
<td><a id = "Blue">#0000FF</a></td>
<td><a id = "Magenta">#FF00FF</a></td>
<td><a id = "Gray">#808080</a></td>
</tr>
<tr>
<td><a id = "Green">#008000</a></td>
<td><a id = "Lime">#00FF00</a></td>
<td><a id = "Maroon">#800000</a></td>
<td><a id = "Navy">#000080</a></td>
</tr>
<tr>
<td><a id = "Olive">#808000</a></td>
<td><a id = "Purple">#800080</a></td>
<td><a id = "Red">#FF0000</a></td>
<td><a id = "Silver">#C0C0C0</a></td>
</tr>
<tr>
<td><a id = "Cyan">#00FFFF</a></td>
<td><a id = "Teal">#008080</a></td>
<td><a id = "Yellow">#FFFF00</a></td>
<td><a id = "White">#FFFFFF</a></td>
</tr>
</table>
</body>
</html>

-onmousedown dan onmouseup


<html>
<head>
<script type="text/javascript">
function lighton()
{
document.getElementById('myimage').src="bulbon.gif";
}
function lightoff()
{
document.getElementById('myimage').src="bulboff.gif";
}
</script>
</head>
<body>
<img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="bulboff.gi
f" width="100" height="180" />
<p>Click and hold to turn on the light!</p>
</body>
</html>
3. # Keuntungan
- Cepat dalam loading
- Tidak memerlukan plug-ins
- membantu dalam membuat website yang user friendly, download cepat, graphic eff
ect, menyediakan functionality yang baik, dan dapat memuat banyak text dan cont
ent secara bersamaan
# Kerugian
- Editing tools yang mahal
- Coding panjang dan kompleks
- tidak semuanya compatible dengan browser

You might also like