$(selector).attr({attribute:value, attribute:value ...})

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("img").attr({width:"50",height:"80"});
});
});
</script>
</head>
<body>
<img src="/i/eg_smile.gif" />
<br />
<button>设置图像的 width 和 height 属性</button>
</body>
</html>

相关文章:

  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-08-24
  • 2022-12-23
  • 2021-07-24
  • 2021-07-11
猜你喜欢
  • 2021-10-14
  • 2021-08-28
  • 2021-12-15
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-06-19
相关资源
相似解决方案