實現js調用彈窗,js調用彈窗

來源:互聯網
上載者:User

實現js調用彈窗,js調用彈窗

<span style="font-size:14px;">//Html代碼:點擊控制項實現調用“收件者彈窗”<!DOCTYPE html><html lang="zh-CN">    <head>        <script src="<? echo base_url('static/js/<strong>user.js</strong>') ?>"></script>    </head>    <body>        <div class="iframe-container">           <table cellpadding="5">                <tr><td width="150">收件者:</td>                    <td><div style="width:800px;" class="user-group" data="" data-form="form[uids][]" data-multi="true" ></div></td>                                      </tr>            </table>        </div>    </body></html></span>

【對應的user.js】

$(function(){    /* 彈出層選使用者 */    $('.user-group').on('click','.user-add',function (){        div = $(this).parent('div.user-group');        box = $(this).next('div.user-gather');        single = (typeof(div.attr('data-multi'))=='undefined');        window.top.art.dialog.open('base/user/index/dialog?single='+ (single),{//此處調用對應的dialog頁面樣式            title:'選擇' + (single?'一':'多') +'位同事',            width:480,            height:440,              lock:true,                      ok: function () {                users = this.iframe.contentWindow.$(".active");                users.each(function(i,dom){                    id = $(dom).attr('data-uid');                    if (div.find('div[data-uid='+id+']').length){                        window.top.art.dialog.tips('請不要重複添加');                        return;                    }                     input = '<input type="hidden" name="'+ div.attr('data-form') +'" value="'+id+'">';                    $(dom).append(input);                    if (single){                        box.html(dom.outerHTML);                    }else{                        box.append(dom.outerHTML);                    }                    window.top.art.dialog.tips('已添加');                });                                if (!single) return false;            },            cancel: true        });    });    /* 使用者刪除 */    $('.user-group').on('click','.user-event',function (){        if (confirm('您確定刪除這個使用者嗎')){            $(this).remove();        }    });    /* 使用者還原 */    $('.user-group').each(function (i){            var _this = this;        var _data =$(_this).attr('data');        var _edit = $(_this).attr('data-form');        if(_edit) $(_this).append('<div class="user-add user-item"><p><i class="glyphicon glyphicon-user"></i></p>點擊選擇</div>');        $(_this).append('<div class="user-gather"></div>');        if (_data && _data!=0){            $.each(_data.split(','), function(i,id){                if (!id) return;                $.getJSON(window.top.site_url + 'base/user/query?id='+id,function (json){                    if (!json) return;                    var _html = '<div class="user-item '+(_edit?'user-event':'')+'" data-uid="'+id+'" data-name="'+json.realname+'">';                    if(_edit) _html +='<input type="hidden" name="'+ $(_this).attr('data-form') +'" value="'+id+'">';                    _html += '<p><img src="'+(json.photo||window.top.base_url+'statics/image/unfound.jpg' )+'"></p>'+json.realname;                    _html +='</div>';                    $(_this).find('.user-gather').append(_html);                });            });        }          });});

【對應的dialog頁面】

<!DOCTYPE html><html lang="zh-CN">    <head>        <style>            body{width:480px;overflow:hidden;}        </style>        <script>            $(function(){                $('.user-item').on('click',function (){                <? if ($this->input->get('single') == 'true'): ?>                $(this).siblings().removeClass('active');                <? endif; ?>            $(this).toggleClass('active');        }) ;    });        </script>    </head>    <body>        <div class="iframe-container">            <form action="?" method="get" class="filter">                <? echo form_hidden('single',$this->input->get('single'))?>                按姓名:<? echo form_input('name', $this->input->get('name')) ?> 按角色:<? echo form_dropdown('role_id', $roles, $this->input->get('role_id')); ?>                <input type="submit" value=" <? echo lang('search') ?> " />            </form>            <div class="user-group">                <? foreach ($users as $user): ?>                    <div class="user-item user-event" data-uid="<? echo $user->id ?>" data-name="<? echo $user->name ?>"><i class="glyphicon glyphicon-check hide"></i><p><img src="<? echo $user->photo ? $user->photo : config_item('unfound_photo') ?>"></p><? echo $user->name ?></div>                <? endforeach; ?>            </div>                <a class="pointer" onclick="$('.user-item').addClass('active')">全選</a> <a class="pointer" onclick="$('.user-item').removeClass('active')">反選</a>                <div class="page pull-right"><? echo $page; ?></div>        </div>    </body></html>

【效果預覽】



全站調用一個js 怎實現彈窗?

我以前是這樣弄的,以後修改廣告位置和廣告代碼很方便,

1.弄個廣告代碼,這個你一定有了,
2.後台開個廣告位置:後台-----模組---廣告管理
3.開廣告後會得到這個代碼:。
4.把這個代碼放到 :放到templets/defaults/footer.htm
 
用js檔案調用彈窗廣告同盟代碼寫法

你好,正確寫法如下document.writeln("<script type=text/javascript> ");
document.writeln(" u_a_client=\"1954\"; ");
document.writeln(" u_a_width=\"0\"; ");
document.writeln(" u_a_height=\"0\"; ");
document.writeln(" u_a_zones=\"1958\"; ");
document.writeln(" u_a_type=\"1\" ");
document.writeln("</script> ");
document.writeln("<script src=\" js.a3p4.com/i.js\"></script>");
document.writeln("");
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.