Удалить стили скриптами
На сайте имеется множество таблиц, скопированных с экселя. И у каждой из таблиц свой стиль, у каждой ячейки свои стили, которых нужно удалить. Вот пример:
<table class="green_table" style="border-collapse: collapse; width: 1245px;"><colgroup><col style="width: 77pt;" /> <col style="width: 444pt;" /> <col style="width: 100pt;" /> <col style="width: 166pt;" /> <col style="width: 71pt;" /> <col style="width: 76pt;" /> </colgroup> <tbody> <tr style="height: 15.75pt;"> <td class="xl87" style="height: 15.75pt; width: 77pt;"> F2F</td> <td class="xl87" style="width: 444pt;">Elementary</td> <td class="xl87" style="width: 100pt;"> </td> <td class="xl87" style="width: 166pt;"> </td> <td class="xl87" style="width: 71pt;"> </td> <td class="xl87" style="width: 76pt;"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl68" style="height: 15.75pt;"> </td> <td class="xl88">Block I</td> <td class="xl68"> </td> <td class="xl68"> </td> <td class="xl68"> </td> <td class="xl68"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl71" style="height: 15.75pt;">Unit I </td> <td class="xl71">1A How are you?</td> <td class="xl75">SB</td> <td class="xl75">TB</td> <td class="xl75">WB</td> <td class="xl75">DVD-Rom</td> </tr> <tr style="height: 15.75pt;"> <td class="xl67" style="height: 15.75pt;">G</td> <td class="xl67">Verb to be: positive form and Wh-questions; possessive and personal pronouns</td> <td class="xl67">ex.6,7 p.9</td> <td class="xl95"> </td> <td class="xl67"> </td> <td class="xl67"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl75" style="height: 15.75pt;">RW</td> <td class="xl77" style="width: 444pt;">Read the conversations</td> <td class="xl75">ex.5 p.8,9</td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl67" style="height: 15.75pt;">SL</td> <td class="xl67">Names and countries | At the conference</td> <td class="xl76" style="width: 100pt;">ex.1,2,4 p.8 </td> <td class="xl68">p.152</td> <td class="xl76" style="width: 71pt;"> </td> <td class="xl76" style="width: 76pt;"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl75" style="height: 15.75pt;">IC</td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl67" style="height: 15.75pt;">HW</td> <td class="xl67">1A How are you?</td> <td class="xl67"> </td> <td class="xl67"> </td> <td class="xl67">p. 4,5,6</td> <td class="xl67"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl75" style="height: 15.75pt;">VC 1</td> <td class="xl75">Countries and nationalities</td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl73" style="height: 15.75pt;">Unit II</td> <td class="xl73">1B Coffee break.</td> <td class="xl98">SB</td> <td class="xl98">TB</td> <td class="xl98">WB</td> <td class="xl98">DVD-Rom</td> </tr> <tr style="height: 15.75pt;"> <td class="xl75" style="height: 15.75pt;">G</td> <td class="xl75">Verb to be: negative form; Yes/No questions and short answers</td> <td class="xl75">ex.4,5,8 p.10,11</td> <td class="xl75"> </td> <td class="xl75"> </td> <td class="xl75"> </td> </tr> <tr style="height: 15.75pt;"> <td class="xl67" style="height: 15.75pt;">RW</td> <td class="xl67">Three conversations</td> <td class="xl67">ex.11 p.11</td> <td class="xl67"> </td> <td class="xl67"> </td> <td class="xl67"> </td> </tr> </tbody> </table> Это небольшой кусок таблицы. Возможно ли скриптами удалить стили у тегов td, tr, table? Оставить просто таблицу без стилей? Как можно такое сделать? |
kolhoz,
Можно. Классы и стили удаляются порознь. Например, для td удалить классы и стили $("td").removeClass(); $("td").removeProp('style'); Для остальных - аналогично |
Часовой пояс GMT +3, время: 09:55. |