Javascript 在文本区域中显示窗口的直接链接
请帮帮我!对不起,我的措辞有些混乱 我需要在文本区域显示窗口的直接链接 例如: 我的链接: 使用:window.location.hrefJavascript 在文本区域中显示窗口的直接链接,javascript,html,hyperlink,window,textarea,Javascript,Html,Hyperlink,Window,Textarea,请帮帮我!对不起,我的措辞有些混乱 我需要在文本区域显示窗口的直接链接 例如: 我的链接: 使用:window.location.href <textarea> ?/?/? window.location.href ?/?/? </textarea> ?/?/?window.location.href?/?/? =>结果如何显示=> <textarea>https://stackoverflow.com/123456</textarea> h
<textarea> ?/?/? window.location.href ?/?/? </textarea>
?/?/?window.location.href?/?/?
=>结果如何显示=>
<textarea>https://stackoverflow.com/123456</textarea>
https://stackoverflow.com/123456
这在文本区域中是不可能的,您需要一个可编辑的内容
div
<div contenteditable="true"></div>
这在文本区域中是不可能的,您需要一个可编辑的
内容
div
<div contenteditable="true"></div>
这在文本区域中是不可能的,您需要一个可编辑的
内容
div
<div contenteditable="true"></div>
这在文本区域中是不可能的,您需要一个可编辑的
内容
div
<div contenteditable="true"></div>
可编辑URL
(功能(){
var bad=document.getElementById('bad'),
奇数=document.getElementById('odd'))
bad.textContent=window.location.href
odd.href=window.location.href
odd.textContent=window.location.href
})()
第二个选项是“奇”而不是“好”,因为您可以更改URL的文本,但A)链接保持不变,B)您必须右键单击它才能浏览到它。也许您需要对事件进行多一点控制,以获得您想要的可编辑链接。
可编辑URL
(功能(){
var bad=document.getElementById('bad'),
奇数=document.getElementById('odd'))
bad.textContent=window.location.href
odd.href=window.location.href
odd.textContent=window.location.href
})()
第二个选项是“奇”而不是“好”,因为您可以更改URL的文本,但A)链接保持不变,B)您必须右键单击它才能浏览到它。也许您需要对事件进行多一点控制,以获得您想要的可编辑链接。
可编辑URL
(功能(){
var bad=document.getElementById('bad'),
奇数=document.getElementById('odd'))
bad.textContent=window.location.href
odd.href=window.location.href
odd.textContent=window.location.href
})()
第二个选项是“奇”而不是“好”,因为您可以更改URL的文本,但A)链接保持不变,B)您必须右键单击它才能浏览到它。也许您需要对事件进行多一点控制,以获得您想要的可编辑链接。
可编辑URL
(功能(){
var bad=document.getElementById('bad'),
奇数=document.getElementById('odd'))
bad.textContent=window.location.href
odd.href=window.location.href
odd.textContent=window.location.href
})()
第二个选项是“奇”而不是“好”,因为您可以更改URL的文本,但A)链接保持不变,B)您必须右键单击它才能浏览到它。也许你需要对事件进行多一点控制,才能获得你想要的可编辑链接。它之所以叫textarea是有原因的,amirite?如果我将“textarea”替换为“input”,那该怎么办?@LêTùng很高兴我能提供帮助。它之所以叫textarea是有原因的,amirite?如果我将“textarea”替换为“input”我很高兴能帮上忙。它叫textarea是有原因的,amirite?如果我把“textarea”换成“input”,它会是怎样的?@LùTùng很高兴我能帮上忙。它叫textarea是有原因的,amirite?如果我把“textarea”换成“input”,它会是怎样的?@LùTùng很高兴我能帮上忙。