• 百度搜红包相关代码(1)


    搜索框下面的代码:

    1
    <table cellpadding="0" cellspacing="0" id="1" mu="http://hongbao.app.baidu.com/hongbao/start"><tr><td class="f">
    <style>
    #op_autoframe_i
    {width:600px;height:450px;border:0}
    </style>
    <iframe id="op_autoframe_i" src="http://hongbao.app.baidu.com/hongbao/start" frameborder='no' marginwidth="0" marginheight="0" scrolling="no"></iframe>
    </td></tr></table>
    很明显,嵌入了

    http://hongbao.app.baidu.com/hongbao/start
    的内容;

    2
    1 <body>
    2 <div class="award-index">
    3 <div class="award-index-bn" onclick="javascript:location.replace('/hongbao/inputname')"></div>
    4 </div>
    5
    6 <!--底部区域-->
    7 <div class="common-bottom">
    8 <div class="detail"><a href="http://chunjie.baidu.com/guize" target="_blank">搜红包活动详则>></a></div>
    9 <div class="link"><div class="url">open.baidu.com/</div><div class="h">-</div><div class="open"><a href="http://open.baidu.com/" target="_blank"><img src="http://chunjie.baidu.com/static/hongbao/images/open.gif"></a></div></div>
    10 </div>
    11  </body>
    12
    点击“我要抢红包”后,进入http://hongbao.app.baidu.com/hongbao/inputname

    3
    1 <!Doctype html>
    2 <html>
    3 <head>
    4 <meta http-equiv="X-UA-Compatible" content="IE=7">
    5 <meta http-equiv="content-type" content="text/html;charset=utf-8">
    6 <link rel="stylesheet" href="http://chunjie.baidu.com/static/hongbao/styles/main.css" type="text/css" />
    7
    8 </head>
    9
    10
    11 <body>
    12 <div class="award-bg">
    13 <div class="banner top"></div>
    14 <div class="banner bottom"></div>
    15
    16 <!--主体区域-->
    17 <div class="main">
    18
    19 <!--logo区域-->
    20 <div class="logo baidulogo"></div>
    21 <div class="logo yaodianlogo"></div>
    22
    23 <!--输入区域-->
    24 <div class="award-form-panel">
    25 <!--顶部提示区域-->
    26
    27
    28 <form action="" method="post" id="form1">
    29
    30
    31 <input name="birthday" type="hidden" id="birthday">
    32 <input name="trace" type="hidden" id="trace">
    33 <input name="token" type="hidden" id="token">
    34 <input name="old" type="hidden" id="old">
    35 <input name="is_alloc" type="hidden" id="is_alloc">
    36
    37 <div class="award-form-inputline">
    38 <div class="inputlabel"><label for="div-name">姓名:</label></div>
    39
    40 <div class="forminput">
    41 <div class="common-input-s">
    42 <input type="text" name="name" id="div-name">
    43 </div>
    44 </div>
    45 <!--验证错误时候提示display:block-->
    46 <div class="inputerror" style="display:none;" id="tip-1">请正确输入姓名</div>
    47 </div>
    48
    49
    50
    51 <div class="award-form-inputline" style="overflow:visible;">
    52 <div class="inputlabel"><label>生日:</label></div>
    53
    54 <div class="forminput" style="overflow:visible;">
    55 <select id="select-year">
    56 <option value="2011">2011</option>
    57 </select>
    58 </div>
    59 <div class="text"></div>
    60
    61
    62 <div class="forminput">
    63 <select id="select-month">
    64 <option value="01">01</option>
    65 </select>
    66 </div>
    67 <div class="text"></div>
    68
    69 <div class="forminput">
    70 <select id="select-day">
    71
    72 <option value="01">01</option>
    73 </select>
    74 </div>
    75 <div class="text"></div>
    76
    77 </div>
    78
    79
    80
    81 <div class="award-form-inputline award-form-verity">
    82 <div class="inputlabel"><label for="captcha">验证码:</label></div>
    83
    84 <div class="forminput">
    85 <div class="common-input-s">
    86 <input type="text" id="captcha" name="captcha">
    87 </div>
    88 </div>
    89 <div class="award-form-vcode" id="div-vcode"></div>
    90 <div class="award-form-vcode-text" style="display:none;" id="div-vcode-text"><a href="###">看不清,换一张</a></div>
    91 </div>
    92
    93
    94
    95 <div class="award-form-inputline award-form-check">
    96 <div class="checkbox"><input type="checkbox" id="check-1"></div>
    97 <div class="declaration"><label for="check-1" id="labelcheck">我已阅读并同意</label><a href="http://chunjie.baidu.com/guize" target="_blank">《2011年百度春节互动活动规则》</a></div>
    98 </div>
    99
    100 <div class="tip-vcode" style="display:none;" id="tip-2">请正确输入验证码</div>
    101
    102
    103 </form>
    104
    105 <div class="award-form-tip-notice"><span>注意:</span>请根据身份证信息填写生日和姓名,否则会影响奖品领取。</div>
    106
    107 <div class="common-button award-bn-next" id="bn"></div>
    108
    109 <div class="tip-declaration" id="tip-3" style="display:none;">请确认已阅读《2011年百度春节互动活动规则》</div>
    110
    111 </div>
    112 </div>
    113 </div>
    114 <!--底部区域-->
    115 <div class="common-bottom">
    116 <div class="detail"><a href="http://chunjie.baidu.com/guize" target="_blank">搜红包活动详则>></a></div>
    117
    118 <div class="link"><div class="url">open.baidu.com/</div><div class="h">-</div><div class="open"><a href="http://open.baidu.com/" target="_blank"><img src="http://chunjie.baidu.com/static/hongbao/images/open.gif"></a></div></div>
    119 </div>
    120 </body>
    121 <!--脚本区域-->
    122 <script type="text/javascript" src="http://chunjie.baidu.com/static/hongbao/scripts/tangram-1.3.2.js"></script>
    123 <script type="text/javascript">
    124 baidu.dom.ready(function(){
    125
    126 var code;
    127 //验证码事件
    128 var VcodeImg = {
    129 init:function(id,tid){
    130 baidu.sio.callByServer("/hongbao/getvcode",function (vcode){
    131 var src = "/hongbao/genimg?vcode="+vcode;
    132 baidu.g(id).innerHTML='<img id="img-vcode" src="'+src+'">';
    133 baidu.g(tid).style.display="block";
    134 code=vcode;
    135 });
    136 },
    137 change:function(id){
    138 baidu.sio.callByServer("/hongbao/getvcode",function (vcode){
    139 var src = "/hongbao/genimg?vcode="+vcode;
    140 baidu.g(id).src=src;
    141 code=vcode;
    142 });
    143 }
    144 };
    145 var init = true;
    146 baidu.event.on(baidu.g("captcha"), "focus", function(e){
    147 if (init){
    148 VcodeImg.init("div-vcode","div-vcode-text");
    149 init = false;
    150 }
    151 });
    152 baidu.event.on(baidu.g("div-vcode-text"),"click",function(e){
    153 VcodeImg.change("img-vcode");
    154 });
    155
    156
    157 //生成年月日下拉列表
    158 var str,
    159 i,
    160 selectYear = baidu.g("select-year").options,
    161 selectMonth = baidu.g("select-month").options,
    162 selectDay = baidu.g("select-day").options;
    163 for (i=2010;i>=1900;i--){
    164 selectYear.add(new Option(i,i));
    165 }
    166 for (i=2;i<=12;i++){
    167 selectMonth.add(new Option((i<10&&"0"||"")+i,(i<10&&"0"||"")+i));
    168 }
    169 for (i=2;i<=31;i++){
    170 selectDay.add(new Option((i<10&&"0"||"")+i,(i<10&&"0"||"")+i));
    171 }
    172
    173
    174
    175
    176
    177 //获取字符数
    178 var getByteLength = function(mm){
    179 return mm.replace(/[^\x00-\xff]/g,"mm").length;
    180 };
    181
    182 var readTip = true;
    183
    184 function submit(){
    185 var name = baidu.g("div-name").value;
    186 var byteLength = getByteLength(name);
    187 if (byteLength<2||byteLength>24){
    188 baidu.g("tip-1").style.display="block";
    189 return;
    190 }
    191 else{
    192 if (!/^[ a-zA-Z\u4e00-\u9fa5]*$/.test(name)){
    193 baidu.g("tip-1").style.display="block";
    194 return;
    195 }
    196 }
    197 if (!baidu.g("check-1").checked){
    198 baidu.g("tip-3").style.display="block";
    199 readTip = false;
    200 return;
    201 }
    202 if (baidu.g("captcha").value==""){
    203 baidu.g("tip-2").style.display="block";
    204 return;
    205 }
    206 var birthday = baidu.g("select-year").value+baidu.g("select-month").value+baidu.g("select-day").value;
    207 baidu.ajax.post("/hongbao/getgift",
    208 "captcha="+baidu.g("captcha").value+"&vcode="+code+"&birthday="+birthday+"&name="+name,
    209 function(xhr,responseText){
    210 var json = baidu.json.parse(responseText);
    211 if (json.errno){
    212 baidu.g("birthday").value=birthday;
    213 baidu.g("trace").value=json.trace;
    214 baidu.g("token").value=json.token;
    215 baidu.g("old").value=json.old;
    216 baidu.g("is_alloc").value=json.is_alloc;
    217 baidu.g("form1").action=json.redirect;
    218 baidu.g("form1").submit();
    219 }
    220 else{
    221 baidu.g("tip-2").style.display="block";
    222 baidu.g("captcha").value="";
    223 VcodeImg.change("img-vcode");
    224 }
    225 });
    226 }
    227
    228
    229 baidu.event.on(baidu.g("bn"), "click", function(e){
    230 submit();
    231 });
    232
    233 baidu.event.on(baidu.g("check-1"),"click",function(){
    234 if (readTip == false){
    235 baidu.g("tip-3").style.display="none";
    236 readTip =true;
    237 }
    238 });
    239
    240 baidu.event.on(baidu.g("labelcheck"),"click",function(){
    241 if (readTip == false){
    242 baidu.g("tip-3").style.display="none";
    243 readTip =true;
    244 }
    245 });
    246
    247 baidu.event.on(baidu.g("captcha"),"focus",function(){
    248 baidu.g("tip-2").style.display="none";
    249 });
    250
    251 setTimeout(function(){
    252 baidu.g("div-name").focus();
    253 },100);
    254
    255 });
    256 </script>
    257
    258
    259 <script src="http://chunjie.baidu.com/static/hongbao/scripts/sync.js"></script>
    260 </html>
    261

  • 相关阅读:
    python每日一题:使用套接字创建分布式进程
    市盈率分析
    python每日一题:分布式进程之坑点
    python每日一题:比较单线程,多线程,协程的运行效率
    python每日一题:锁知识点
    python每日一题:查找一篇文档中的人名和城市
    python之装饰器@
    python每日一题:利用字典实现超市购物程序
    【Java基础】多线程
    【Java基础】异常处理
  • 原文地址:https://www.cnblogs.com/htfy/p/1949689.html
Copyright © 2020-2023  润新知