首页 新闻 会员 周边 捐助

怎么解决js代码中的重定向那个问题

0
[已解决问题] 解决于 2015-08-09 18:33

<html>

<head>
<meta charset="UTF-8" />
<title>模仿手机充值界面</title>
<style type="text/css">
html,body{
width:100%;
}
.container{
width:400px;
height:200px;
margin: 0 auto;
}
.container table{border-collapse:collapse;}
.container td{
border-collapse:collapse;
border:1px solid black;
text-align: center;
}
</style>
</head>

<body>
<div class="container">
<form>
<table>
<tr>
<td colspan="2">在线手机充值业务(95折)</td>
</tr>
<tr>
<td>充值的手机号码:</td>
<td><input type="text" name="phone" value="" id="phone" /></td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="money" value="30" onclick="mySelect(this.value)" />30&nbsp;
<input type="radio" name="money" value="50" onclick="mySelect(this.value)" />50&nbsp;
<input type="radio" name="money" value="100" onclick="mySelect(this.value)" />100&nbsp;
</td>
</tr>
<tr>
<td>折后价</td>
<td id="price"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="" value="充值" onclick="tijiao()" /></td>
</tr>
</table>
</form>
</div>
</body>

<script type="text/javascript">
function tijiao(){
var phone = document.getElementById("phone");
var money = document.getElementById("price");
alert("你要给手机号" + phone.value + "充值" + money.innerHTML + "元吗?");
}

function mySelect(select){
var price = document.getElementById("price");
price.innerHTML = select*0.95;
}
</script>
</html>

Tcooop的主页 Tcooop | 菜鸟二级 | 园豆:202
提问于:2015-08-09 15:07
< >
分享
最佳答案
0

alert改成if(confirm("你要给手机号"+phone.value+"充值"+money.innerHtml+"元吗?"))

{

    //location.assign("http://www.baidu.com");

    window.location="转向的网址";

    //location.href="http://www.baidu.com";

}

奖励园豆:5
如此低调的男人 | 小虾三级 |园豆:842 | 2015-08-09 18:15
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册