我想用js輸出一個(gè)a的超鏈接,鏈接的內(nèi)容想用location對(duì)象獲取可以么?怎么實(shí)現(xiàn)?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>location</title>
</head>
?<script type="text/javascript">
? ? ?document.write(window.location.href);
?</script>?
</head>?
<body>
</body> ? ? ??
</html> ??
2016-10-27
document.getElementsByTagName('a')[i].href
i表示第幾個(gè)a標(biāo)簽。
2016-10-27
var lk=location.href
<a href=lk>點(diǎn)擊</a>
思路大概是這樣子吧,我也不太懂
2016-10-27
你現(xiàn)在獲取的是window對(duì)象的url,也就是當(dāng)前瀏覽器的URL,如果想獲取a鏈接的,就這樣