Heim  >  Artikel  >  Web-Frontend  >  使用JavaScript动态设置样式实现代码(2)_javascript技巧

使用JavaScript动态设置样式实现代码(2)_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:42:541086Durchsuche

你可以参考到前一版本 http://www.jb51.net/article/33555.htm 这个有点不好的地方,就是如果想改变样式,也许得使用查找替换才行。

因此,Insus.NET写出另外一个方法来实现,这样可以改一应用百。
先写一个样式Style:

复制代码 代码如下:



Javascript也要改一下:
复制代码 代码如下:



最后是html的动态应用。
复制代码 代码如下:

onmouseover="onOver(this)" onmouseout="onOut(this)">
ERP http://xxx.xxx.com/erp

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn