开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 1099|回复: 1
打印 上一主题 下一主题
收起左侧

[其它求助] 求助Html无法修改文本框中的值

[复制链接]
结帖率:63% (17/27)
跳转到指定楼层
楼主
发表于 2018-2-9 10:13:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式   山东省潍坊市
50精币
调用Javascript想点击100 300 500的单选按钮来修改 文本框 <input  id="WIDtotal_amount" name="WIDtotal_amount" />中的值,但是试了几种方法都失败了,求大佬指点一下
<?php


header("Content-type: text/html; charset=utf-8");


require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeWapPayContentBuilder.php';
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
if (!empty($_POST['WIDout_trade_no'])&& trim($_POST['WIDout_trade_no'])!=""){
    //商户订单号,商户网站订单系统中唯一订单号,必填
    $out_trade_no = $_POST['WIDout_trade_no'];

    //订单名称,必填
    $subject = $_POST['WIDsubject'];

    //付款金额,必填
    $total_amount = $_POST['WIDtotal_amount'];

    //商品描述,可空
    $body = $_POST['WIDbody'];

    //超时时间
    $timeout_express="1m";

    $payRequestBuilder = new AlipayTradeWapPayContentBuilder();
    $payRequestBuilder->setBody($body);
    $payRequestBuilder->setSubject($subject);
    $payRequestBuilder->setOutTradeNo($out_trade_no);
    $payRequestBuilder->setTotalAmount($total_amount);
    $payRequestBuilder->setTimeExpress($timeout_express);

    $payResponse = new AlipayTradeService($config);
    $result=$payResponse->wapPay($payRequestBuilder,$config['return_url'],$config['notify_url']);

    return ;
}
?>
<!DOCTYPE html>
<html>
        <head>
        <title>中国移动网上营业厅</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <link href="css/layout.css" rel="stylesheet" type="text/css" />
<style>
    *{
        margin:0;
        padding:0;
    }
    ul,ol{
        list-style:none;
    }
    body{
        font-family: "Helvetica Neue",Helvetica,Arial,"LucIDA Grande",sans-serif;
    }
    .hidden{
        display:none;
    }
    .new-btn-login-sp{
        padding: 1px;
        display: inline-block;
        width: 75%;
    }
    .new-btn-login {
        background-color: #02aaf1;
        color: #FFFFFF;
        font-weight: bold;
        border: none;
        width: 100%;
        height: 30px;
        border-radius: 5px;
        font-size: 16px;
    }
    #main{
        width:100%;
        margin:0 auto;
        font-size:14px;
    }
    .red-star{
        color:#f00;
        width:10px;
        display:inline-block;
    }
    .null-star{
        color:#fff;
    }
    .content{
        margin-top:5px;
    }
    .content dt{
        width:100px;
        display:inline-block;
        float: left;
        margin-left: 20px;
        color: #666;
        font-size: 13px;
        margin-top: 8px;
    }
    .content dd{
        margin-left:120px;
        margin-bottom:5px;
    }
    .content dd input {
        width: 85%;
        height: 28px;
        border: 0;
        -webkit-border-radius: 0;
        -webkit-appearance: none;
    }
    #foot{
        margin-top:10px;
        position: absolute;
        bottom: 15px;
        width: 100%;
    }
    .foot-ul{
        width: 100%;
    }
    .foot-ul li {
        width: 100%;
        text-align:center;
        color: #666;
    }
    .note-help {
        color: #999999;
        font-size: 12px;
        line-height: 130%;
        margin-top: 5px;
        width: 100%;
        display: block;
    }
    #btn-dd{
        margin: 20px;
        text-align: center;
    }
    .foot-ul{
        width: 100%;
    }
    .one_line{
        display: block;
        height: 1px;
        border: 0;
        border-top: 1px solid #eeeeee;
        width: 100%;
        margin-left: 20px;
    }
    .am-header {
        display: -webkit-box;
        display: -ms-flexbox;
        display: box;
        width: 100%;
        position: relative;
        padding: 7px 0;
        -webkit-box-sizing: border-box;
        -ms-box-sizing: border-box;
        box-sizing: border-box;
        background: #1D222D;
        height: 50px;
        text-align: center;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        box-pack: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        box-align: center;
    }
    .am-header h1 {
        -webkit-box-flex: 1;
        -ms-flex: 1;
        box-flex: 1;
        line-height: 18px;
        text-align: center;
        font-size: 18px;
        font-weight: 300;
        color: #fff;
    }

        .i{width:100%}
        .ii{width:95%}
                .shadow {
    -moz-box-shadow: -3px 3px 4px #999;
    -webkit-box-shadow: -3px 3px 4px #999;
    box-shadow: -3px 3px 4px #999;
}
td{  background:#E4E4E4; padding:5px 2px; width:20%}

</style>
</head>
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
<div class="wapper" >
<center>
<div align="left"><img src="img/1.png" width="236" /></div>
<div style="width:95%; padding:5px; color:#666666" align="right">
手机营业厅|积分商城|关于中国移动|政企客户
</div>
<table width="100%"><tr><td align="center">
首页</td><td align="center">移动商城</td><td align="center">我的移动</td>
<td align="center" style="color:#15ADFF; border-top:2px solid #15ADFF">营业厅</td>
<td align="center">服务支持</td></tr></table>
<div align="right" style="padding-right:3px; margin:5px 0px">首页><span style="color:#0273D9">我要充值</span>><span style="color:#0273D9">话费充值</span>>网上交费</div>
<div id="main">

<div style="width:95%;border:1px solid #E1E1E1; border-radius:5px" align="left">

<div style="padding:5px">
<div style="background:#66A4D5; padding:5px; color:#FFF; width:30%; float:left" align="left">1.填写号码</div>
<div style="background:#DFDFDF; padding:5px; color:#656565; width:30%; float:left; margin-left:1px" align="left">2.确认并支付</div>
<div style="background:#DFDFDF; padding:5px; color:#656565; width:30%; float:left; margin-left:1px" align="left">3.完成</div>
<div style=" clear:both"></div>
<script type="text/javascript">
        function zj(j)
        {
                if(j<100)
                {
                zj1=j*0.99;
                        document.getElementById("zf").innerHTML=zj1+"元"
                        document.getElementById("zfje").value=zj1
                        document.getElementById("dz").innerHTML=j+"元"
                        document.getElementById("dzje").value=j
                        document.getElementById("WIDtotal_amount").value = "99.00";
                }
                else
                {
                        if(j=="100")
                        {
                        zj1=j*0.99;
                        zs=parseInt(j)+100
                        document.getElementById("zf").innerHTML=zj1+"元"
                        document.getElementById("zfje").value=zj1
                        document.getElementById("dz").innerHTML=zs+"元<span style='color:red'>(赠送100元)</span>"
                        document.getElementById("dzje").value=zs        
                        document.getElementById("WIDtotal_amount").value = "99.00";
                        }
                        if(j=="300")
                        {
                        zj1=j*0.99;
                        zs=parseInt(j)+300
                        document.getElementById("zf").innerHTML=zj1+"元"
                        document.getElementById("zfje").value=zj1
                        document.getElementById("dz").innerHTML=zs+"元<span style='color:red'>(赠送300元)</span>"
                        document.getElementById("dzje").value=zs
                        document.getElementById("WIDtotal_amount").value = "297.00";
                        }
                        if(j=="500")
                        {
                        zj1=j*0.99;
                        zs=parseInt(j)+500
                        document.getElementById("zf").innerHTML=zj1+"元"
                        document.getElementById("zfje").value=zj1
                        document.getElementById("dz").innerHTML=zs+"元<span style='color:red'>(赠送500元)</span>"
                        document.getElementById("dzje").value=zs
                        document.getElementById("WIDtotal_amount").value = "395.00";        
                        }
                        
                }
        }
</script>
<script type="text/javascript">
function postcheck(){

        if (document.getElementById("WIDout_trade_no").value==""){
                alert('请填写手机号码!');
                document.getElementById("WIDout_trade_no").focus();
                return false;
        }        
        var reg2 = /^1[3,4,5,8]\d{9}$/;
        if (!reg2.test(document.getElementById("WIDout_trade_no").value)){
            alert('请填写正确的手机号码!');
                document.getElementById("WIDout_trade_no").focus();
                return false;
        }
        return true;

}
</script>
        <form name=alipayment action='' method=post target="_blank">
        <div style=" clear:both; margin-top:5px">
        <div id="body" style="clear:left">
<p style="padding:3px; background:#EEF5FF; border:1px solid #D0E0EB; display:inline">手机号码</p><input type="text" id="WIDout_trade_no" name="WIDout_trade_no"  style="margin-left:8px" />
<p style="height:10px"></p>
<p style="padding:3px; background:#EEF5FF; border:1px solid #D0E0EB; display:inline">充值金额</p>
<input type="radio" checked="checkd" name="je"  />100元<input type="radio"  name="je"  />300元<input type="radio"  name="je"   />500元
<p style="height:10px"></p>
<p style="padding:3px; background:#EEF5FF; border:1px solid #D0E0EB; display:inline">支付金额</p>&nbsp;&nbsp;<span style="font-weight:bold; color:#EE860B" id="zf">99元</span>
<p style="height:10px"></p>
<p style="padding:3px; background:#EEF5FF; border:1px solid #D0E0EB; display:inline">实际到账</p>&nbsp;&nbsp;<span style="font-weight:bold" id="zf">100元<span style='color:red'>(赠送100元)</span></span>


<p style="height:10px"></p>
<p style="padding:3px; background:#EEF5FF; border:1px solid #D0E0EB; display:inline">充值优惠</p>&nbsp;&nbsp;<span style="color:red">(享受9.9折优惠)</span><br />
<p style="font-size:12px; margin-top:5px">1、网厅充值使用支付宝交话费,即可享受 9.9折优惠<br />
2、活动截至日期:3月1号(一个手机号码仅限充值一次)
</p>
</div>
<center><input type="submit" style="width:40%; padding:5px; background:#0065B5; color:#FFF; border-radius:5px; border:none" align="center" value="开始充值"></center>
            
                <dl class="content">

                    <dd>

                    </dd>

                    <dd>
                        <input type="hidden" id="WIDsubject" name="WIDsubject" />
                    </dd>
     
                    <dd>
                        <input  id="WIDtotal_amount" name="WIDtotal_amount" />
                    </dd>
                    
                    <dd>
                        <input type="hidden" id="WIDbody" name="WIDbody" />
                    </dd>
                    <dt></dt>
                    <dd id="btn-dd">
                     
                        
                    </dd>
                </dl>
            </div>
                </form>
       <div style="font-size:12px; padding:5px">
         <p style="padding-bottom:5px; border-bottom:1px solid #999"> </p>
<img src="img/w.png" style=" display:inline" />温馨提示<br />
1、宽带用户请输入手机号码或209账户号码进行充值。 <br />
2、目前只提供为移动号码充值,神州行亲情卡使用网上充值将不能延长话费有效期。 <br />
3、充值金额需为100元的倍数,单个用户单笔交费最低100元,最高5000元。 <br />
4、网银缴话费目前支持工商银行、建设银行、农业银行、招商银行等多家银行。 <br />
5、使用网银时,请注意保护个人隐私或安装浏览器插件。 <br />
</div>
</div></div>
<p style="margin-top:15px; font-size:12px; color:#999" align="center">
Copyright 1999-2018  中国移动  版权所有<br />
中华人民共和国增值电信业务经营许可证<br />经营许可证编号:A2.B1.B2-20100001
</p>
</center>
</div>
</body>
<script language="javascript">
        function GetDateNow() {
                var vNow = new Date();
                var sNow = "";
                sNow += String(vNow.getFullYear());
                sNow += String(vNow.getMonth() + 1);
                sNow += String(vNow.getDate());
                sNow += String(vNow.getHours());
                sNow += String(vNow.getMinutes());
                sNow += String(vNow.getSeconds());
                sNow += String(vNow.getMilliseconds());
               
                document.getElementById("WIDsubject").value = "话费充值";
                document.getElementById("WIDtotal_amount").value = "99.00";
        document.getElementById("WIDbody").value = "话费充值";
        }
        GetDateNow();
</script>
</html>


回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。
友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
快捷通道:申请荣誉值无答案申请取消悬赏投诉有答案未采纳为最佳

结帖率:95% (19/20)

签到天数: 2 天

沙发
发表于 2018-2-9 14:40:39 | 只看该作者   山东省东营市
document.getElementsByName("je")[0].setAttribute("checked","checked")
document.getElementsByName("je")[1].setAttribute("checked","checked")
document.getElementsByName("je")[2].setAttribute("checked","checked")
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报QQ: 793400750,邮箱:[email protected]
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表