动态修改a标签的css样式
<!DOCTYPE html>
<
html
>
<
head
>
问<
meta
charset
=
"UTF-8"
>
<
title
></
title
>
<
style
type
=
"text/css"
>
a{
width: 50px;
height: 50px;
background: red;
}
</
style
>
</
head
>
<
body
>
<
script
>
var number;
function clicke() {
var a = document.getElementById("mya");
a.style.cssText +="; display:block;width: 100%;height:200px;background: yellow;";
}
</
script
>
<
a
id
=
"mya"
href
=
"#"
onclick
=
"clicke()"
>点击我答</
a
>
</
body
>
</
html
>
$("#mya").addClass("on");
本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/12694221.html