js获取当前页面url并写入input的方法
完整源码如下:
<!DOCTYPE html>
<html>
<script>
window.onload = function(){
document.getElementById('url').value = location.href;
}
</script>
<body>
<input id="url" type="text" style="width: 500px;">
</body>
</html>
<!DOCTYPE html>
<html>
<script>
window.onload = function(){
document.getElementById('url').value = location.href;
}
</script>
<body>
<input id="url" type="text" style="width: 500px;">
</body>
</html>
顶(1)
踩(0)
- 最新评论