صورة يستطيع تحريكها الزائر الى اليمين و اليسار
طريقة التركيب
1- ضع هذا الكود في الرأس HEAD <!-- Original: Massimo Giari (motore@iol.it) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->
<script language="JavaScript">
/* Visit
http://www.star28.com/ for more code */
<!-- Begin
var ieKey, nKey;
n = (document.layers) ? 1 : 0;
ie = (document.all) ? 1 : 0;
function moveImage() {
if (n) {
block = document.blockDiv;
}
if (ie) {
block = blockDiv.style;
}
block.xpos = parseInt(block.left);
block.active = 0;
document.onkeydown = keyDown;
document.onkeyup = keyUp;
if (n) {
document.captureEvents(Event.keydown | Event.keyup);
}
}
function keyDown(e) {
if (n) {
nKey = e.which;
ieKey = 0;
}
if (ie) {
ieKey = event.keyCode;
nKey = 0;
}
if ((nKey == 97 || ieKey == 65) && !block.active) {
block.active = 1;
slideLeft();
}
if ((nKey == 100 || ieKey == 68) && !block.active) {
block.active = 1;
slideRight();
}
}
function keyUp(e) {
if (n) {
nKey = e.which;
ieKey = 0;
}
if (ie) {
ieKey = event.keyCode;
nKey = 0;
}
if ((nKey == 97 || ieKey == 65 || nKey == 100 || ieKey == 68))
block.active = 0;
}
function slideRight() {
if (block.active) {
block.xpos += 5;
block.left = block.xpos;
status = block.xpos;
setTimeout("slideRight()", 25);
}
}
function slideLeft() {
if (block.active) {
block.xpos -= 5;
block.left = block.xpos;
status = block.xpos;
setTimeout("slideLeft()", 25);
}
}
// End -->
</script>
<div id="blockDiv" STYLE="position:absolute; left:180px; top:110px; width:260px; height:28px">
<img src="SSSS.gif"></div>
2- أضف هذا الكود ضمن الوسم BODY لتصبح هكذا <body onLoad="moveImage()">