解决方案 »

  1.   

    而且  b.jsp 里   
    $(document).ready(function(){
    alert("x5");       
     });  这个都没反应。
      

  2.   

    你这是弹出框架页,与A.jsp没有关系了。
    在B.jsp链接jquery文件才可以用$('#baojingid')
      

  3.   


    我试了 也不行 单独访问b.jsp  才会执行
    $(document).ready(function()
      

  4.   

    $('#baojingid')   这个根本就没有获取到对象。你加载B。jsp  若果是用的iframe加载的 ,根本就不是同一个页面,
    你可以用开发工具看看页面元素到底是用什么加载的B页面, 若果是用iframe加载,你可以在父页面内先获取iframe的document对象,再取到baojingid元素,之后在操作这个元素。
      

  5.   

    b.jsp   也要引jquery的js包。
      

  6.   

    我引包了,在a页面定义了个div在 通过某个按钮的点击事件弹出窗口,窗口href直接连接b页面,没有用iframe
      

  7.   


    我引包了,在a页面定义了个div在 通过某个按钮的点击事件弹出窗口,窗口href直接连接b页面,没有用iframe先不说这个对象 就是b.jsp页面里 $(document).ready(function()  这个方法都木有执行
      

  8.   


    我引包了,在a页面定义了个div在 通过某个按钮的点击事件弹出窗口,窗口href直接连接b页面,没有用iframe先不说这个对象 就是b.jsp页面里 $(document).ready(function()  这个方法都木有执行
    不能够啊  你是不是包的路径没写对 
      

  9.   


    我引包了,在a页面定义了个div在 通过某个按钮的点击事件弹出窗口,窗口href直接连接b页面,没有用iframe先不说这个对象 就是b.jsp页面里 $(document).ready(function()  这个方法都木有执行
    不能够啊  你是不是包的路径没写对 应该不会有错  我不通过A页面去访问B页面  就是直接浏览器访问B页面  方法又会执行
      

  10.   

    你用的location.href=url这种方式吗 正常跳到B页面了? 
      

  11.   


    在B页面 用<a href="B.jsp">aaaa</a>  这种 跳到B页面 并且执行了方法 
    B窗口我是通过 下面这种方式弹出来的,url,大小等都是点击事件触发openchuang方法传参来弹出
    function openchuang(titl,url,wid,heig){  //添加窗口
    $('#wintime').window({ 
        title:titl,   
        width:wid,    
        height:heig,    
        modal:false,
        href:url,
        iconCls:'icon-tip'
    });
    }
      

  12.   


    打错了 在A页面 用<a href="B.jsp">aaaa</a>
      

  13.   

    $('#baojingid')   这个根本就没有获取到对象。你加载B。jsp  若果是用的iframe加载的 ,根本就不是同一个页面,
    你可以用开发工具看看页面元素到底是用什么加载的B页面, 若果是用iframe加载,你可以在父页面内先获取iframe的document对象,再取到baojingid元素,之后在操作这个元素。
      

  14.   

    你这个应该是用iframe加载的 
      

  15.   


      
    这么解决  不行啊 问题还是没解决  我刚看了下 B页面的所有元素都是 以DIV形式 在A页面里的
      

  16.   

    function openchuang(titl,url,wid,heig){  //添加窗口
    $('#wintime').window({ 
        title:titl,   
        width:wid,    
        height:heig,    
        modal:false,
        href:url,
        iconCls:'icon-tip'
    });
    }
    这个东西应该有回调函数吧   你在回调函数中调用$('#baojingid')  或者  你保证上边的代码执行完 ,在调用$('#baojingid')。
      

  17.   

    呼  是不是  B页面的内容其实是在A页面? 所以方法写在A页面的JS里有用 写在B里面就没用
      

  18.   

    呼  是不是  B页面的内容其实是在A页面? 所以方法写在A页面的JS里有用 写在B里面就没用若果你是用iframe加载的,你就要写到A页面。
      

  19.   

    若果你不是用iframe加载的
    你就要写到A页面。
      

  20.   


    没有用到iframe    写在A页面也可以 但是 窗口弹出 即 打开B页面的时候 也要触发一个方法 这个怎么解决。
      

  21.   


    没有用到iframe    写在A页面也可以 但是 窗口弹出 即 打开B页面的时候 也要触发一个方法 这个怎么解决。弹出窗口 后你不就是要选取$('#baojingid')  ,操作这个吗 
    既然是同一个页面  ,就正常选取就行了 。不过你的保证你调用$('#baojingid') 时候这个B页面已经加载到A页面了 :$('#wintime').window({ 
        title:titl,   
        width:wid,    
        height:heig,    
        modal:false,
        href:url,
        iconCls:'icon-tip'
    });这个东西应该有回调函数吧   你在回调函数中调用$('#baojingid')  或者  你保证上边的代码执行完 ,在调用$('#baojingid')。
      

  22.   


    没有用到iframe    写在A页面也可以 但是 窗口弹出 即 打开B页面的时候 也要触发一个方法 这个怎么解决。弹出窗口 后你不就是要选取$('#baojingid')  ,操作这个吗 
    既然是同一个页面  ,就正常选取就行了 。不过你的保证你调用$('#baojingid') 时候这个B页面已经加载到A页面了 :$('#wintime').window({ 
        title:titl,   
        width:wid,    
        height:heig,    
        modal:false,
        href:url,
        iconCls:'icon-tip'
    });这个东西应该有回调函数吧   你在回调函数中调用$('#baojingid')  或者  你保证上边的代码执行完 ,在调用$('#baojingid')。回调函数,还没怎么仔细看  我来仔细看看
      

  23.   


    没有用到iframe    写在A页面也可以 但是 窗口弹出 即 打开B页面的时候 也要触发一个方法 这个怎么解决。弹出窗口 后你不就是要选取$('#baojingid')  ,操作这个吗 
    既然是同一个页面  ,就正常选取就行了 。不过你的保证你调用$('#baojingid') 时候这个B页面已经加载到A页面了 :$('#wintime').window({ 
        title:titl,   
        width:wid,    
        height:heig,    
        modal:false,
        href:url,
        iconCls:'icon-tip'
    });这个东西应该有回调函数吧   你在回调函数中调用$('#baojingid')  或者  你保证上边的代码执行完 ,在调用$('#baojingid')。或者 还有别的什么方式么? 你平时没有用到弹窗的么? 
      

  24.   

    我用jquery 的dialog加iframe 自己写的方法 ,是弹出来不过要调用 iframe中的元素 ,还是麻烦啊 你这样试试。
     function openchuang(titl,url,wid,heig){  //添加窗口
    $('#wintime').window({ 
        title:titl,   
        width:wid,    
        height:heig,    
        modal:false,
        href:url,
        iconCls:'icon-tip'
    });
    if($('#baojingid')!=null||$('#baojingid')!='underfind')
    alert('ok');
    }
      

  25.   

    我觉得你这个完全是可以解决的  ,我用的给你吧 
    function closeDialog(){

    if ($("#div_cmmbDialog").get(0) != null) {$("#div_cmmbDialog").dialog("close");}
    }(function($) {//弹出窗口:可包含子窗口
    $.showDialog = function(_title, _url, _width, _height){
    var iwidth = 600;
    var iheight = 400;
    if (_width) iwidth = _width;
    if (_height) iheight = _height; if ($("#div_cmmbDialog").get(0) == null) {
            $("body").append("<div id=\"div_cmmbDialog\"    title=\""+_title+"\"></div>");
            $("#div_cmmbDialog").append("<iframe id='frm_cmmbDialog' name='frm_cmmbDialog' width='100%' height='100%'"
                    +" marginwidth='0' marginheight='0' scrolling='auto' frameborder='0' "
                    +" border='0' framespacing='2' noresize='noresize' vspale='0'></iframe>");        $("#div_cmmbDialog:ui-dialog").dialog("destroy");
            $("#div_cmmbDialog").dialog({
                autoOpen: false,
                modal: true,
                width: iwidth,
                height: iheight
            });
        }

    //解决缓存的问题
        if (_url.indexOf("?")>0){
         _url += "&"+Math.floor(Math.random() * 1000);
        }
        else{
         _url += "?"+Math.floor(Math.random() * 1000);
        }
        $("#ui-dialog-title-div_cmmbDialog").html(_title);
    $("#frm_cmmbDialog").attr("src",_url);
    $("#div_cmmbDialog").attr("title",_title);
    $("#div_cmmbDialog").dialog("open");
    }
    })(jQuery);
      

  26.   

    $(function(){showDialog('22','close.html',800,600);});
      

  27.   


    大哥 谢谢您了  我在这慢慢对着弄。这个要引jquery-ui-1.8.10.custom.js 这个包 ,或者其他的 含有dialog 的包 ,你要是没有 ,你留个QQ给你发个包
      

  28.   


    还有 我突然觉得可以这样做  多个窗口 我在A页面定义多个DIV 因为之前我是共用了一个增加方法来弹出窗 现在我可以一个DIV 就定义一个 方法  而且方法里可以用AJAX   ,这好像就可以解决 窗口打开的数据  然后B页面的事件 其实是要写在A页面的JS里面
      

  29.   


    大哥 谢谢您了  我在这慢慢对着弄。这个要引jquery-ui-1.8.10.custom.js 这个包 ,或者其他的 含有dialog 的包 ,你要是没有 ,你留个QQ给你发个包
    我会去网上找  多谢了
      

  30.   


    大哥 谢谢您了  我在这慢慢对着弄。这个要引jquery-ui-1.8.10.custom.js 这个包 ,或者其他的 含有dialog 的包 ,你要是没有 ,你留个QQ给你发个包并且 我B页面都不需要 把组件都定义在A页面里面
      

  31.   

     window.setInterval("getJson()","5000");
       
        
    $(getJson);
    function  getJson(){

    var tb=$("#tbStu").empty();
    $("<tr> <th >用户全名 </th><th>用户手机号</th><th>用户单位</th><th>用户部门</th><th>系统类型</th><th>请求时间</th><th>操作类型</th></tr>").appendTo(tb);


    $.ajax({
    type:'post',
    url:'getJson.action',

    dataType:'html',
    async: false,
    success:function(msg){
    var s=eval(msg);

    $(s).each(function(key,val){


    tr=$("<tr></tr>");

    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\">"+val.username+"</td>").appendTo(tr);
    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\">"+val.mobile+"</td>").appendTo(tr);
    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\">"+val.cpname+"</td>").appendTo(tr);
    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\">"+val.depname+"</td>").appendTo(tr);
    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\">"+val.system+"</td>").appendTo(tr);
    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\">"+val.reqtime+"</td>").appendTo(tr);
    $("<td onclick=\"openwindow('loadMoLogInfo.action?pid="+val.pid+"','',1000,600);\" >"+val.typecode+"</td> ").appendTo(tr);
    tr.appendTo("#tbStu")

    });

    }
    });

     $("#tbStu tr:nth-child(odd)").css("background-color","#fff");
      $("#tbStu tr").hover( function(){$(this).css("background-image","url(../common/style/blue/images/table_title_bg.png)");},
    function(){$(this).css("background-image","");});
    }
      

  32.   

    模仿的不对,看不出来哪里错了 。
      <table id="baojingtab" class="easyui-datagrid" border="0" style="width:660px;height:330px" data-options="pagination:true,fitColumns:false,toolbar:'#tb'">
         <thead>  
            <tr>   
                <th data-options="field:'ck',width:40,align:'center'"><input type="checkbox"/></th>   
                <th data-options="field:'vin',width:100,align:'center'">车辆名称</th>   
                <th data-options="field:'account',width:160,align:'center'">所属公司</th>
                <th data-options="field:'time',width:150,align:'center'">时间</th>   
                <th data-options="field:'exception',width:200,align:'center'">报警信息</th>    
            </tr>   
        </thead>   
        <tbody >    
        </tbody>
       </table>
    这是表格 
    下面是数据
     success: function(data){
    if(data!=null && data.length!=0){
    // $('#baojingtab').empty();
    var bjdata=eval(data);
    $(bjdata).each(function(key,val){
    // alert(val.vin);
    tr=$("<tr></tr>");
    $("<td><input type='checkbox' name='armcheck' id= '"+val.exceptionID+"'></td>").appendTo(tr);
    $("<td>"+val.vin+"</td>").appendTo(tr);
    $("<td>"+val.account+"</td>").appendTo(tr);
    $("<td>"+val.zoneID+"</td>").appendTo(tr);
    $("<td>"+val.errorMessage+"</td>").appendTo(tr);
    tr.appendTo("#baojingtab");
    });
    }
      }
    这几个数据都是有的  哪里错了吗?
      

  33.   

    你这easyUI  用这种不行 ,下班了 你先自己研究一下 ,明天我要是有时间 ,再帮你看看。
      

  34.   

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>EasyUI Demo</title><link rel="stylesheet" type="text/css" href="../jquery/jquery-easyui-1.3.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../jquery/jquery-easyui-1.3.3/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../jquery/jquery-easyui-1.3.3/demo/demo.css">
    <script type="text/javascript" src="../jquery/jquery-1.10.0.min.js"></script>
    <script type="text/javascript" src="../jquery/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>  <script type="text/javascript">
    $(function(){$('#dg').datagrid({ url:'json.json', 
    onLoadSuccess:onLoadSuccess,
    pagination:true,
    pagePosition:"top",
    toolbar: [{  
      iconCls: 'icon-edit',  
      handler: function(){alert('edit')}  
      },'-',{  
      iconCls: 'icon-help',  
      handler: function(){alert('help')}  
      }],
    checkOnSelect:true,
    columns:[[ 
    {field:'aa',checkbox:true},
    {field:'code',title:'Code',width:100}, {field:'name',title:'Name',width:100}, {field:'price',title:'Price',width:100,align:'right'} ]] }); 
    })
    function onLoadSuccess(data){//每次删除和添加后触发该函数var tr2=$("<tr class='datagrid-row'></tr>");$(".datagrid-row").each(function(k,v){//遍历所有行
    $("td",this).each(function(key,val){
    var td=$("td",tr2.get(0)).eq(key);
    if(td.text()!=null&&td.text()!='undefined'&&td.text()!=""){

    td.text(parseFloat(td.text())+parseFloat($(val).text()));

    }else{
    $("<td>"+$(val).text()+"</td>").appendTo(tr2);}
    });
    });tr2.appendTo(".datagrid-btable tbody");}
     </script></head>
    <body><!-- javsscript 定义表格 -->
    <table id="dg"></table>
      
    </body>
    </html>
    以下是测试json
    {"total":44,"rows":[{"code":"001","name":"3","price":"44355"},{"code":"001","name":"5","price":"44355"},{"code":"001","name":"4","price":"44355"},{"code":"001","name":"7","price":"44355"}]}
    你看看这个例子 会对你有点启发 ,你要用开发工具看看 ,生成的表格的名字叫啥 ,之后选取表格 ,往表格里放数据。
      

  35.   

    你要是不用easyUI  你就用上边的例子做 。你要是用easyUI  其实也不难实现。
      

  36.   

    解决js、css问题最简单的方法就是提供能够还原问题的精简demo,不然大家都自个猜,浪费各自时间。