如标题..如何让 src 成为我从另一个输入中得到的?她的是我的密码...
<script type="text/javascript">
function newLink() {
var myNewLink = document.getElementById("link");
localStorage.setItem('link', myNewLink.value);
}
function newIcon() {
var myNewIcon = document.getElementById("icon");
localStorage.setItem('icon', myNewIcon.value);
}
</script>
<form>
<h1>lägg till länk</h1><br />
<input type="text" id="link"><br />
<input type="text" id="icon"><br />
<button onClick="newLink(); newIcon();">lägg till länk</button>
</form>
<a href="#" onClick="location.href = localStorage.getItem('link')"><img src="localStorage.getItem('icon')" id="image"></a>