Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码:
<script type="text/javascript"> document.getElementById('link1').href = "images/favicon2.ico"; </script>
它在 Chrome 中工作,但我需要它在 Internet Explorer 中工作。我该怎么做?
利用HTMLElement.setAttribute()
HTMLElement.setAttribute()
document.getElementById('link1').setAttribute('href', 'images/favicon2.ico');