jQuery 矩形內(nèi)數(shù)字逆時(shí)針旋轉(zhuǎn)

<!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">

? ? <style type="text/css">

? ? ? ? .mytable

? ? ? ? {

width:300px;

? ? ? ? }

.mytable td{height:100px;border:1px solid #aaccff;text-align:center;}

.mytable td label{font-size:60px;font-weight:bold;color:Red;}

.box{border:1px solid #aaccff;padding:10px;margin:5px 3px;line-height:25px;}

? ? <script src="jquery-1.12.4.js">

? ? ? ? $(function () {

window.setInterval(fun, 300);

? ? ? ? });

? ? ? ? function fun() {

$("#table1 label")

//監(jiān)聽事件:獲取label的值集合

? ? ? ? ? ? ? ? .map(function (value, index) {

//獲取到單個(gè)label的文本值

? ? ? ? ? ? ? ? var $txt =$(index).text();

? ? ? ? ? ? ? ? //將其轉(zhuǎn)換為int型

? ? ? ? ? ? ? ? ? ? $txt =parseInt($txt);

? ? ? ? ? ? ? ? if ($txt ==8) {

//給當(dāng)前l(fā)abel賦值

? ? ? ? ? ? ? ? ? ? $(index).text("1");

? ? ? ? ? ? ? ? }

else {

//給當(dāng)前l(fā)abel賦值

? ? ? ? ? ? ? ? ? ? $(index).text($txt +1);

? ? ? ? ? ? ? ? }

});

? ? ? ? }


<body style="font-size:12px;">

? ? <div class="box">

? ? ? ? 請(qǐng)編寫javascript代碼,完成如下功能要求:

? ? ? ? 1.每隔300毫秒,讓所有的數(shù)字逆時(shí)針旋轉(zhuǎn)

? ? <div class="box">

? ? ? ? <table id="table1" class="mytable">

? ? ? ? ? ? ? ? ? ? <label id="Label1">1

? ? ? ? ? ? ? ? ? ? <label id="Label2">2

? ? ? ? ? ? ? ? ? ? <label id="Label3">3

? ? ? ? ? ? ? ? ? ? <label id="Label8">8

? ? ? ? ? ? ? ? ? ? <label id="Label4">4

? ? ? ? ? ? ? ? ? ? <label id="Label7">7

? ? ? ? ? ? ? ? ? ? <label id="Label6">6

? ? ? ? ? ? ? ? ? ? <label id="Label5">5

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容