จากโค้ดมันแสดงที่background แต่ถ้าผมจะให้มันไปอยู่ในแท็ก <div></div> หรือ <table> ต้องแก้ตรงไหนครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
n=1;
function slide_pic()
{ var filename;
switch(n){
case 1:filename = "Equipment_ryobi756.jpg";
break;
case 2:filename = "Equipment_756_2.jpg";
break;
}
n++
if (n>2) n= 1;
document.getElementById('slidepic').background = "Pic/" + filename;
window.setTimeout("slide_pic();",2000);
}
</script>
</head>
<body id="slidepic">
<script language="javascript">slide_pic();</script>
<div style=" font-size:60; color:#000; text-align:center; background-color:#FF0">แสดง</div>
</body>
</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>
<script language="javascript">
n=1;
function slide_pic()
{ var filename;
switch(n){
case 1:filename = "Equipment_ryobi756.jpg";
break;
case 2:filename = "Equipment_756_2.jpg";
break;
}
n++
if (n>2) n= 1;
document.getElementById('slidepic').background = "Pic/" + filename;
window.setTimeout("slide_pic();",2000);
}
</script>
</head>
<body id="slidepic">
<script language="javascript">slide_pic();</script>
<div style=" font-size:60; color:#000; text-align:center; background-color:#FF0">แสดง</div>
</body>
</html>