Home  >  Article  >  Backend Development  >  框架中输入电话号码后按确定跳到一个网页。该怎么解决

框架中输入电话号码后按确定跳到一个网页。该怎么解决

WBOY
WBOYOriginal
2016-06-13 13:20:391125browse

框架中输入电话号码后按确定跳到一个网页。
怎样写HTML?
比如(这里填入手机号码)点击确认
会出现在下面这个链接里。http://www.xxxx.com/sds/sdfsd?fsd手机号码sdfr.eft.com

------解决方案--------------------

HTML code


<input id="phone_num">
<input type="button" id="btn_submit" value="提交">
<div id="result"></div>
<script>
    var $ = function(id){return document.getElementById(id);}
    $('btn_submit').onclick = function(){
        var src = "http://www.xxxx.com/sds/sdfsd?fsdsdfr.eft.com";
        $('result').innerHTML = src.replace(/sdsd/, "sd"+$('phone_num').value+"sd");
    }
</script>


<br><font color="#e78608">------解决方案--------------------</font><br>
HTML code




<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>



<script>
    function test(){
        var tel = document.form.phone.value;
        alert("phone-->>"+tel);
        var url = "http://www.xxxx.com/sds/sdfsd?fsd"+tel+"sdfr.eft.com";
        alert("url-->>"+url);
    }
</script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn