JS ตระหนักถึงเอฟเฟกต์การเลื่อนและเปลี่ยนสี ในหน้าจอแสดงผลเอฟเฟกต์คุณสามารถดูหน้าจอที่เปลี่ยนสีเปลี่ยนสีเพื่อดึงดูดความสนใจของผู้คน เอฟเฟกต์ดีจริงๆ หลังจากคัดลอกรหัสไปยังเว็บไซต์ของคุณแล้วจะสามารถแก้ไขได้เป็นข้อความที่ต้องการ
ต่อไปนี้เป็นซอร์สโค้ด:
การคัดลอกรหัสมีดังนี้:
<html>
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<title> การเลื่อนข้อความเปลี่ยนสี JS เอฟเฟกต์พิเศษ </title>
</head>
<body>
<div>
โปรดทราบข้อความด้านล่างข้อความบางส่วนเป็นสีแดงย้อมและการเคลื่อนไหวสีแดงในลูป <a href = "http://keleyi.com/a/bjad/bd55blos.htm" target = "_ blank"> ข้อความต้นฉบับ </a>
</div>
<script type = "text/javascript">
var message = "ยินดีต้อนรับสู่ keleyi.com นี่คือสื่อการเรียนรู้เช่น Web Front-end"
var neonbasecolor = "#3333333"
var neontextColor = "#ff0000"
var neontextcolor2 = "#ff3333"
var flashspeed = 100
var flashingletters = 8
var flashingletters2 = 2
var flashpause = 0
var n = 0
if (document.all || document.getElementById) {
document.write ('<font color = "'+neonbasecolor+'">')
สำหรับ (m = 0; m <message.length; m ++)
document.write ('<span id = "neonlight'+m+'">'+message.charat (m)+'</span>')
document.write ('</font>')
-
อื่น
document.write (ข้อความ)
ฟังก์ชั่น CrossRef (หมายเลข) {
var crossobj = document.all? evals ("document.all.neonlight"+หมายเลข): document.getElementById ("neonlight"+หมายเลข)
กลับ crossobj
-
ฟังก์ชั่นนีออน () {
ถ้า (n == 0) {
สำหรับ (m = 0; m <message.length; m ++)
Crossref (M) .style.color = neonbasecolor
-
crossref (n) .style.color = neontextcolor
if (n> flashingletters-1) CrossRef (n-flashingletters) .style.color = neontextcolor2
if (n> (Flashingletters+Flashingletters2) -1) CrossRef (N-flashingletters-Flashingletters2) .style.color = neonbasecolor
if (n <message.length-1)
N ++
อื่น{
n = 0
ClearInterval (กระพริบ)
settimeout ("startneon ()", flashpause)
กลับ
-
-
ฟังก์ชั่นเริ่มต้น () {
if (document.all || document.getElementById)
Flashing = setInterval ("Neon ()", flashspeed)
-
เริ่มต้น ()
</script>
<div> <br/> <a href = "http://keleyi.com" target = "_ blank"> keleyi.com </a> </div>
</body>
</html>