posts - 149, comments - 163, trackbacks - 0, articles - 1
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

2008年8月16日



<? xml version="1.0" encoding="utf8"  ?>
<% @ page language = " java "  contentType = " text/html; charset=utf8 "  pageEncoding = " utf8 " %>
<% @taglib uri = " /WEB-INF/struts-tags.tld "  prefix = " s " %>
<% @taglib uri = " /WEB-INF/ljw.tld "  prefix = " ljw " %>
    

<% @page import = " com.ljw.bean.CorrectionWrong " %>
<% @page import = " com.ljw.bean.CorrectionWrong.State " %>
<% @page import = " com.opensymphony.xwork2.util.ValueStack " %> < html  xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta  http-equiv ="Content-Type"  content ="text/html; charset=utf8"   />
< title > Insert title here </ title >
< script  type ="text/javascript"  src ="../js/prototype.js" ></ script >
< script  type ="text/javascript"  src ="../js/jsMsg.jsp" ></ script >
< script  type ="text/javascript"  src ="../js/comm.js" ></ script >
< SCRIPT  language =JavaScript  src ="../js/supertable/dialog.js"  type =Text/JavaScript ></ SCRIPT >
</ head >
< body >
< div  id ="communityDiv" >
< s:set  name ="" ></ s:set >
< s:iterator  id ="d"  value ="%{pageList.objectList}" >
    用户名字:
< s:property  value ="#d.userInfo.userName" />< br >
    url:
< s:property  value ="#d.url" />< br >
    状态:
< s:property  value ="#d.ecwState.value" />< br >
    纠错:
< s:property  value ="#d.cwArticle" /></ br >
    编辑输入:
< textarea  rows ="10"  cols ="50"  id ='<s:property  value ="#d.id" /> ' > < s:property  value ="#d.boardmasterDesc" /></ textarea >
    
< input  type ="button"  onclick ="getUpdate('<s:property value=" #d.id" /> ')"/>
< hr />
</ s:iterator >
< br />
< ljw:pages  value ="%{pageList.pages}"  javaScript ="loadCommunityListUrl" />
</ div >
</ body >
< script  type ="text/javascript" >
function  loadCommunityListUrl(url) {
     $('communityDiv').innerHTML 
=  pageLoadingCenter;
      
var  urls  =  getActionName(url);
      
var  pars  =  getActionPars(url);
      
var  myAjax  =   new  Ajax.Updater( " communityDiv " , urls, {method: 'post', parameters: pars});
    }
var  request  =   false ;
try  {
  request 
=   new  XMLHttpRequest();
catch  (trymicrosoft) {
  
try  {
    request 
=   new  ActiveXObject( " Msxml2.XMLHTTP " );
  } 
catch  (othermicrosoft) {
    
try  {
      request 
=   new  ActiveXObject( " Microsoft.XMLHTTP " );
    } 
catch  (failed) {
      request 
=   false ;
    }  
  }
}
if  ( ! request)
  alert(
" Error initializing XMLHttpRequest! " );
  
var  _robj  =   null  ;
function  getUpdate(ki) {
  _robj 
=  document.getElementById(ki) ;
  
var  urls  = 'cwmain. do ';
  
var  pars  =  'c = ajaxUpdateByBoardMaster & cwId = ' + ki + ' & boardMasterDesc = ' + _robj.value ;
  request.open(
" POST " , urls,  true );
  request.setRequestHeader(
" Cache-Control " , " no-cache " );
  request.setRequestHeader(
" content-type " , " application/x-www-form-urlencoded " );
  request.send(pars);
  request.onreadystatechange 
=
 updatePage;
}




function  updatePage() {
    
if  (request.readyState  ==   4 ) {
        
if  (request.status  ==   200   ||  request.status == 0  ) {
            alert(request.responseText);
            eval('
var  ajaxData  = ' + request.responseText);
            
if ( ajaxData.isUpdate ){
                 alert( '更新成功!' );
            }
else {
                alert( '更新不成功!' );
            }
        } 
    }
}



</ script >
</ html >

posted @ 2008-08-16 18:15 G_G 阅读(38) | 评论 (0)编辑 收藏



< html >   
< head >< title > 拖动效果函数演示 by Longbill.cn </ title >   
< style >   

div  
{   
    position 
:  absolute ;   
    background-color 
:  #c3d9ff ;   
    margin 
:  0px ;   
    padding 
:  5px ;   
    border 
:  0px ;   
    width 
:  100px ;   
    height
: 100px ;   
}   
</ style >

</ head >   
< body >   
    
    
< script >   
function  drag(o,s)  
{  
    
if  ( typeof  o  ==   " string " ) o  =  document.getElementById(o);  
    o.orig_x 
=  parseInt(o.style.left)  -  document.body.scrollLeft;  
    o.orig_y 
=  parseInt(o.style.top)  -  document.body.scrollTop;  
    o.orig_index 
=  o.style.zIndex;  
          
    o.onmousedown 
=   function (a)  
    {  
        
this .style.cursor  =   " move " ;  
        
this .style.zIndex  =   10000 ;  
        
var  d = document;  
        
if ( ! a)a = window.event;  
        
var  x  =  a.clientX + d.body.scrollLeft - o.offsetLeft;  
        
var  y  =  a.clientY + d.body.scrollTop - o.offsetTop;  
        
// author: www.longbill.cn  
        d.ondragstart  =   " return false; "   
        d.onselectstart 
=   " return false; "   
        d.onselect 
=   " document.selection.empty(); "   
                  
        
if (o.setCapture)  
            o.setCapture();  
        
else   if (window.captureEvents)  
            window.captureEvents(Event.MOUSEMOVE
| Event.MOUSEUP);  

        d.onmousemove 
=   function (a)  
        {  
            
if ( ! a)a = window.event;  
            o.style.left 
=  a.clientX + document.body.scrollLeft - x;  
            o.style.top 
=  a.clientY + document.body.scrollTop - y;  
            o.orig_x 
=  parseInt(o.style.left)  -  document.body.scrollLeft;  
            o.orig_y 
=  parseInt(o.style.top)  -  document.body.scrollTop;  
        }  

        d.onmouseup 
=   function ()  
        {  
            
if (o.releaseCapture)  
                o.releaseCapture();  
            
else   if (window.captureEvents)  
                window.captureEvents(Event.MOUSEMOVE
| Event.MOUSEUP);  
            d.onmousemove 
=   null ;  
            d.onmouseup 
=   null ;  
            d.ondragstart 
=   null ;  
            d.onselectstart 
=   null ;  
            d.onselect 
=   null ;  
            o.style.cursor 
=   " normal " ;  
            o.style.zIndex 
=  o.orig_index;  
        }  
    }  
      
    
if  (s)  
    {  
        
var  orig_scroll  =  window.onscroll ? window.onscroll: function  (){};  
        window.onscroll 
=   function  ()  
        {  
            orig_scroll();  
            o.style.left 
=  o.orig_x  +  document.body.scrollLeft;  
            o.style.top 
=  o.orig_y  +  document.body.scrollTop;  
        }  
    }  
}  
</ script >   

< div  id ="div1"  style ="left:10px;top:10px;" > div1:我可以被拖动 </ div >   
< div  id ="div2"  style ="left:120px;top:10px;background-color : #f3d9ff" > div2:来拖我呀 </ div >   
< div  id ="div3"  style ="left:230px;top:10px;background-color : #c3ffff" > div3:我随便你拖 </ div >   
< div  id ="div4"  style ="left:10px;top:120px;background-color : #c3d944" > div4:我可以随窗口滑动,把我拖到最下面,然后滚动网页看看 </ div >   
< div  id ="div5"  style ="left:120px;top:120px;background-color : #f3d944" > 作者: Longbill
< href =http://www.longbill.cn  target =_blank > www.longbill.cn </ a >   
</ div >   
< div  id ="div6"  style ="left:230px;top:120px;background-color : #e3f944;width:200px;" > 参数说明:
  
drag(obj [,scroll]);
  
obj:对象的id或对象本身;
  
scroll(可选):对象是否随窗口拖动而滑动,默认为否
  
鼠标右键查看源代码  
</ div >   


< script >   
drag(
" div1 " );  
drag(
" div2 " );  
drag(
" div3 " );  
drag(
" div4 " , 1 );  
drag(
" div5 " , 1 );  
drag(
" div6 " , 1 );  


</ script >   

</ body >  

posted @ 2008-08-16 17:22 G_G 阅读(27) | 评论 (0)编辑 收藏

2008年8月14日

demo 下载: http://www.blogjava.net/Files/Good-Game/div_.rar
运行 div.html


html:
<html>
<head>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="drag.js"></script>
<META http-equiv=Content-Type content="text/html; charset=utf8">
</head>

<body>
<a
    
onclick="getDrag(event,
                     'ajax.html?id=5',
                     'position:absolute;display:none;left:50;  top:10;  z-index:1000;  padding:0px;  background-color:#FFFFCC;  color:#201000;  font-size:12px;  border:5px   solid   #284860;',
                      'background-color:#CCFFCC;')"
>测试使用(请点击)
</a>
</body>
</html>



js.
// 参考 : http://hi.baidu.com/foxlively/blog/item/0ce341b3f0c050a2d8335af8.html
//
 使用 : prototype.js 
//
使用方法 
var _div1 = null;
var _style2 = null;

function getDrag(event, url,divId, style1, style2) {
    
    
if (style2)
        _style2 
= style2;
    
else
        _style2 
= "";
    
    
if(divId==null)
        _div1 
= document.createElement("div");
    
else
        _div1 
= document.getElementById(divId);
    
    _div1.style.position 
= 'absolute';
    _div1.style.display 
= 'none';

    
if (_div1.style.border == null || _div1.style.border == '')
        _div1.style.border 
= '1px solid #284860';

    
if (style1)
        _div1.setAttribute('style', style1);
    actionAjax(url);
    document.body.appendChild(_div1);
    showByEvent(event, _div1);
}


function getActionName(url) {
    
var question = url.indexOf("?");
    
if (question > 0) {
        
return url.substring(0, question);
    }
    
else {
        
return url;
    }
}

function getActionPars(url) {
    
var question = url.indexOf("?");
    
if (question > 0) {
        
return url.substring(question+1, url.length);
    }
    
else {
        
var d = new Date();
        
var t = d.getTime();
        
return "timestamp="+t;
    }
}


function actionAjax(url) {
    
var urls = getActionName(url);
    
var pars = getActionPars(url);
    
var myAjax = new Ajax.Updater(_div1, urls, {
        method :'post',
        parameters :pars,
        onComplete :_action
    });
}

function _action(req) {
    
var varhtml = "<div id=\"_drag_div\" style=\""
            + _style2
            + 
"\" align=\"right\"><br/><a href=\"javascript:;\" onclick=\"this.parentNode.parentNode.style.display='none';this.parentNode.parentNode.innerHTML=null;\">[关闭]</a></div>"
            
+ req.responseText
            
+"<div id=\"_drag_div\" style=\""
            + _style2
            + 
"\" align=\"left\"><br/><a href=\"javascript:;\" onclick=\"this.parentNode.parentNode.style.display='none';this.parentNode.parentNode.innerHTML=null;\">[关闭]</a></div>"
            ;
    
//varhtml =  varhtml.replace(/form[ ]+action=["'](.*)["']/gi, "form action=\"javascript:actionAjax('$1');\" ")  ;
                              
    _div1.innerHTML 
= varhtml;
    
var drag = new Drag();
    
// drag.build(div1);//拖动本身
    drag.build(_div1, _div1.firstChild);// 通过一个对象拖动另一个对象
    //drag.build(_div1, _div1.lastChild);// 通过一个对象拖动另一个对象
}


function showByEvent(event, useDiv) {
    useDiv.style.display 
= "";
    useDiv.style.left 
= mouseX(event);
    useDiv.style.top 
= mouseY(event);
}


function mouseX(ev) {
    
if( ev == null )ev = event || window.event ;
    
if(ev.clientX){
        
return ev.clientX + document.body.scrollLeft - document.body.clientLeft;
    }
else if(ev.pageX){
        
return ev.pageX;
    }
}
function mouseY(ev) {
    
if( ev == null )ev = event || window.event ;
    
if(ev.clientY){
        
return ev.clientY + document.body.scrollTop - document.body.clientTop ;
    }
else if(ev.pageX){
        
return ev.pageY;
    }
}

function Drag() {
}
Drag.prototype.baseX 
= 0;
Drag.prototype.baseY 
= 0;
Drag.prototype.lastX 
= 0;
Drag.prototype.lastY 
= 0;
Drag.prototype.nowX 
= 0;
Drag.prototype.nowY 
= 0;
Drag.prototype.obD 
= null;
Drag.prototype.obM 
= null;
Drag.prototype.build 
= function(_obD, _obM) {
    
if (_obM) {
        Drag.prototype.obM 
= _obM;
    } 
else {
        Drag.prototype.obM 
= _obD;
    }
    Drag.prototype.obD 
= _obD;
    Drag.prototype.obM.onmousedown 
= function(event) {
        Drag.prototype.lastX 
= mouseX(event);
        Drag.prototype.lastY 
= mouseY(event);
        Drag.prototype.baseX 
= Drag.prototype.obD.style.left;
        Drag.prototype.baseY 
= Drag.prototype.obD.style.top;
        
this.onmousemove = function(event) {
            Drag.prototype.nowX 
= mouseX(event);
            Drag.prototype.nowY 
= mouseY(event);
            Drag.prototype.obD.style.left 
= (parseFloat(Drag.prototype.baseX)
                    
+ Drag.prototype.nowX - Drag.prototype.lastX)
                    
+ "px";
            Drag.prototype.obD.style.top 
= (parseFloat(Drag.prototype.baseY)
                    
+ Drag.prototype.nowY - Drag.prototype.lastY)
                    
+ "px";
        }
    }
    Drag.prototype.obM.onmouseup 
= function(event) {
        
// obD.onmouseup = null;
        Drag.prototype.obD.onmousemove = null;
        Drag.prototype.obM.onmousemove 
= null;
    }
    Drag.prototype.obM.onmouseout 
= function() {
        
// obM.onmouseup = null
        Drag.prototype.obM.onmousemove = null;
        Drag.prototype.obD.onmousemove 
= null;
    }
}

posted @ 2008-08-14 14:11 G_G 阅读(30) | 评论 (0)编辑 收藏

2008年8月9日

参考:http://www.programbbs.com/bbs/view25-12320-1.htm
但上面的 一些sql语句 ,有查询时间问题,在此我已于改正了并希望和大家分享。

---------自我感觉 第四题 很不错!-------------


----------------------------------------------------------------------
第一题(只要重复的都要 输出)
----------------------------------------------------------------------
create table c (id int );
insert into c values (1),(2),(3),(4),(3),(5),(6),(1);
结果:
    
select id from c group by id having count(id)>1 ;


----------------------------------------------------------------------
第二题(报表查询横向输出)
查询后的结果:
Create table d(id int,name varchar(50));
insert into d values(1,'gly');
insert into d values(2,'ptgly');
insert into d values(3,'ybgly');
insert into d values(4,'ptgly');
insert into d values(5,'ybgly');
+---+-----+------+
|gly|ptgly|ybgly |     
|---+-----+------+-
|1  |2    |2     |
+---+-----+------+
-----------------------------------------------------------------------
select 
    
sum(case when name='gly' then 1 else 0 end ) as gly  ,
    
sum(case when name='ptgly' then 1 else 0 end ) as ptgly  ,
    
sum(case when name='ybgly' then 1 else 0 end ) as ybgly  
from d ;



第三题
可以根据上面 2,4 可以得出 。
下面我们详细说下 4题。


-----------------------------------------------------------------------
第四题(复杂组合查询!)
create table table_a (No int, No2 int,num double,itime date);
insert into table_a values
     (1234,567890,33.5,'2004-12-21'),
     (1234,598701,44.8,'2004-11-21'),
     (1234,598701,45.2,'2004-10-01'),
     (1234,567890,66.5,'2004-9-21'),
     (3456,789065,22.5,'2004-10-01'),
     (3456,789065,77.5,'2004-10-27'),
     (3456,678901,48.5,'2004-12-21');
按月统计销售表中货物的销售量数
查询结果如下:
  No, No2 ,   九月,  十月,十一月,十二月
1234,567890, 66.5 ,  0 ,  0  ,  33.5
1234,598701,  0   , 45.2, 44.8, 0
3456,789065, 0  ,  100,  0  ,  0
3456,678901, 0 ,    0,    0  ,  48.5
-----------------------------------------------------------------------
//当然也可以 使用mysql 时间函数 在软件编辑时 你可以输入 String[] 并根据数据动态拼写 sql( case部分!! )
//这个 例子很好 哦!报表可以一句sql 得出!

select NO,NO2,
    
sum(case  when itime like '2004-%9%' then num else 0 endas 9M,
    
sum(case  when itime like '2004-10%' then num else 0 endas 10M,
    
sum(case  when itime like '2004-11%' then num else 0 endas 11M,
    
sum(case  when itime like '2004-12%' then num else 0 endas 12M
from table_a group by no,no2 order by no,no2 ;


--------------------------------------------------------------
第五题
代码,名称
1     a
2     b
11    c
(代码11表示为1的下级)
我要通过一条句子,得出如下结果:

代码,名称,有无下级
1     a     有
2     b     无
11    c     无


Create table TabTest(t_Code varchar(10),t_Name varchar(10));
insert into TabTest values('1','a');
insert into TabTest values('2','b');
insert into TabTest values('11','c');
--------------------------------------------------------------
select tt1.t_Code,tt1.t_name,( 
     
case 
             
when exists (select 1 from tabtest tt2 
                                       
where tt2.t_code like CONCAT(tt1.t_code,'%'and 
                                        tt2.t_code 
<> tt1.t_code )  then 'you' 
             
else 'wu'
      
end ) as you_wu
from tabtest  tt1 ;








posted @ 2008-08-09 22:00 G_G 阅读(1526) | 评论 (6)编辑 收藏

2008年8月7日

官方 http://jsptags.com/tags/navigation/pager/index.jsp

先向 demo 页面样式:
########################################################################################
request.getParameter 中参数
'pager.offset'=6
分页中标签中隐含属性 'offset'=6
|< <<1234567>>>|
7
8
9

|< <<1234567>>>|
#######################################################################################


<%@ page session="false" %>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>Pager Tag Library Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">


<!-- 参数展现 -->
request.getParameter 中参数
<br/>
<%for(Object otmp : request.getParameterMap().keySet() ){%>
    
<%