鼠标按下时如何改变字体颜色等,急!一定结贴!

Grace2003 2003-10-20 03:49:09
如何在javascript的函数中实现OnClick事件发生时,改变原来字体的颜色、大小等,谢了,解决后马上结贴!
...全文
75 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
suhuoqiang 2003-10-20
  • 打赏
  • 举报
回复
<span id=test1>Test text</span>
<button onclick="test1.style.font.bold=true;">bold</button>
<button onclick="test1.style..background=''">Change image</button>
bencalie 2003-10-20
  • 打赏
  • 举报
回复
变成粗体
test1.style.fontWeight="bold";

改变文本左边的图片
img1.src = "test.jpg";
suhuoqiang 2003-10-20
  • 打赏
  • 举报
回复
<span id=test1>Test text</span>

<button onclick="test1.innerHTML='<font color=red><B>Test text</B></font>'">Change
Color</button>

<button onclick="test1.innerHTML ='<img src=111.jpg >'">Change Color</button>
suhuoqiang 2003-10-20
  • 打赏
  • 举报
回复
<span id=test1>Test text</span>

<button onclick="test1.innerHTML='<font color=red>Test text</font>'">Change
Color</button>

<button onclick="test1.innerHTML ='<font color=red size=5>Test text</font>'">Change Color</button>
Grace2003 2003-10-20
  • 打赏
  • 举报
回复
如果我想变成粗体,并且要改变文本左边的图片,该怎么做,谢谢了。
bencalie 2003-10-20
  • 打赏
  • 举报
回复
<span id=test1>Test text</span>
<button onclick="test1.style.color='red'">Change Color</button>
<button onclick="test1.style.fontSize='30px'">Change Size</button>

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧