ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => หัวข้อเริ่มโดย: mikeyx ใน 11 เมษายน 2008, 14:16:16

ชื่อเรื่อง: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: mikeyx ใน 11 เมษายน 2008, 14:16:16
http://www.net-com.co.th/2005/th/home/index.php

ประมาณนี้ครับเขาใช้เทคนิคอะไรทำ ???
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: EThaiZone ใน 11 เมษายน 2008, 14:28:30
ก็ css ไงครับ  ???

/*ลิงค์ปกติ*/
a:link { color:#0000FF; text-decoration:none }

/*ลิงค์เข้าชมแล้ว*/
a:visited { color:#0000FF; text-decoration:none }

/*ลิงค์ที่กำลังถูกกด*/
a:active { color:#FF9900; text-decoration:none }

/*ลิงค์ที่เมาส์กำลังอยู่เหนือลิงค์*/
a:hover { color:#FF9900; text-decoration:none }
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: mikeyx ใน 11 เมษายน 2008, 15:14:44
คือเปลี่ยนสีทั้งเวบเลยนะครับ

อันนั้นมันลิงค์เฉย ๆไม่ใช่หรอครับ
คือที่ผมต้องการคือ เปลี่ยนสี เวบเลยอะ
แบบ yahoo
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: EThaiZone ใน 11 เมษายน 2008, 15:25:30
อ้อ เพิ่งสังเกต

ลองดูโค้ดเหล่านี้ประกอบ ก็น่าจะเก็ทนะครับ


//ส่วนแรก อยู่ใน head
<link href="../../css/style1.css" rel="stylesheet" type="text/css">
<link href="../../css/style2.css" rel="stylesheet" type="text/css">
<link href="../../css/style3.css" rel="stylesheet" type="text/css">
<link href="../../css/style4.css" rel="stylesheet" type="text/css">
<link href="../../css/style5.css" rel="stylesheet" type="text/css">

//ส่วนสองเป็นจาวาสคริป
function changeSheets(whichSheet){
  whichSheet=whichSheet-1;
  if(document.styleSheets){
var c = document.styleSheets.length;
for(var i=1;i<c;i++){
  if(i!=whichSheet){
document.styleSheets[i].disabled=true;
  }else{
document.styleSheets[i].disabled=false;
  }
}
  }
}

//ส่วนสามอยู่ใน body ที่เป็นจุดใช้เปลี่ยนสี
          <td width="22"><a href="?act=setColor&color=1"><img src="../../images/color1.gif" width="14" height="14" border="0" onMouseOver="changeSheets(1)"></a></td>
          <td width="22"><a href="?act=setColor&color=2"><img src="../../images/color2.gif" width="14" height="14" border="0" onMouseOver="changeSheets(2)"></a></td>
          <td width="22"><a href="?act=setColor&color=3"><img src="../../images/color3.gif" width="14" height="14" border="0" onMouseOver="changeSheets(3)"></a></td>
          <td width="22"><a href="?act=setColor&color=4"><img src="../../images/color4.gif" width="14" height="14" border="0" onMouseOver="changeSheets(4)"></a></td>
          <td width="22"><a href="?act=setColor&color=5"><img src="../../images/color5.gif" width="14" height="14" border="0" onMouseOver="changeSheets(5)"></a></td>


เทคนิคเข็มขัดสั้นนะเนี่ย  :P
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: mikeyx ใน 11 เมษายน 2008, 15:34:48
ขอบคุณครับเข็ดขัดสั้นอีกและ ผมคิดมากไปเอง เอิ๊ก ๆๆ
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: jiw ใน 11 เมษายน 2008, 16:10:45
เข้ามาตอบไม่ทัน 55+


ถ้าเป็นผม ผมก็แนวๆข้างบน ... ใช้  java script แล้วก็ onChange ไปเลย


เป็นความรู้ที่ได้จากการเรียนมา ^^
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: ฉันไม่มีตัวตน ใน 11 เมษายน 2008, 16:51:50
ขอบคุณครับขอรับไปเลยละกัน

ปล.ยังใจดีเหมือนเดิม :-*
ชื่อเรื่อง: Re: เอาเมาส์ไปวางแล้วสีเปลี่ยน ทำยังไงหรอครับ
โพสต์โดย: Dr.K ใน 11 เมษายน 2008, 17:40:53
Thx มากๆครับ