ページが読み込まれるときにURLをテキストフィールドに表示します。 私はこれを試してみましたが、それはうまくいきませんでした:ページの読み込み時にテキストフィールドに現在のURLを挿入
function getUrl() {
var url = document.URL;
document.getElementById("textfield").value = url;
}
<input type="text" name="textfield" id="textfield" readonly="true" onload="getUrl()" value="">
試みます。var URL = window.location.href; – darron614