Trending News
關於css程式的問題
<td class="style1" onMouseOver="this.style.backgroundColor='#FFCCBD';" onMouseOut="this.style.backgroundColor='#F3EDFD';" align="middle">
上面是css可以隨游標指到表格上時可以改變顏色的程式碼
看不懂的話這裡有網址
<a href="http://dob.tnc.edu.tw/themes/old/showPage.php?s=37... size="2">http://dob.tnc.edu.tw/themes/old/showPage.php?s=37...
但如果我想把上面的程式碼寫到asp中
也就是用 response.write " " 來寫
請問要怎麼個寫法
我是這麼寫的
response.write "<td class='style1' onMouseOver='this.style.backgroundColor='#FFCCBD';' onMouseOut='this.style.backgroundColor='#F3EDFD';' align='middle'>"
但似乎沒有作用,可能是哪裡寫錯了,但我就是找不出來
請高手們幫幫我吧,感謝 !
2 Answers
- 卜維丰Lv 52 decades agoFavorite Answer
你好,
你是單雙引號使用上出了問題
onMouseOver='this.style.backgroundColor='#FFCCBD';'
事實上只有 onMouseOver='this.style.backgroundColor='
後面的單引號把後面的字都給斷光了
在 asp 中,如果你要寫出雙引號,就連用兩個雙引號即可,比如,原始 HTML 是
<td class="style1" onMouseOver="this.style.backgroundColor='#FFCCBD';" onMouseOut="this.style.backgroundColor='#F3EDFD';" align="middle">
你要用 Response.Write 來寫,把上面這行的雙引號,都變成兩個連續雙引號,如:
<td class=""style1"" onMouseOver=""this.style.backgroundColor='#FFCCBD';"" onMouseOut=""this.style.backgroundColor='#F3EDFD';"" align=""middle"">
最後再加上 Response.Write,如:
Response.Write "
<td class=""style1"" onMouseOver=""this.style.backgroundColor='#FFCCBD';"" onMouseOut=""this.style.backgroundColor='#F3EDFD';"" align=""middle"">"
- BlogezLv 42 decades ago