0

我有这个代码:

<script type="text/javascript">
  document.getElementById('link1').href = "images/favicon2.ico"; 
</script>

它在 Chrome 中工作,但我需要它在 Internet Explorer 中工作。我该怎么做?

4

1 回答 1

0

利用HTMLElement.setAttribute()

document.getElementById('link1').setAttribute('href', 'images/favicon2.ico');
于 2013-06-12T06:52:34.843 回答