求解我需要一个html页面,这个页面里面有一个输入框,一个提交我在文本框中输入,https://segmentfault.com/ ,然后点提交的时候 打开的是这个页面http//localhost/y.php?_u=https://segmentfault.com/ 这个要怎么实现,小白求助
2 回答
富国沪深
TA贡献1790条经验 获得超9个赞
试一下这个
<input id="name" type="text">
<button onclick="Submit();">提交</button>
<script>
let url = 'http://localhost/y.php?_u=';
function Submit () {
let name = document.getElementById('name'),
nameValue = name.value
Url = '';
Url = url + nameValue;
console.log(Url);
window.location = Url;
}
</script>
添加回答
举报
0/150
提交
取消