1、顯示文章:空兩格 <p style="text-indent: 2em">愛施德發生髮送</p> 2、導航內容滾動公告:
<SCRIPT language=JavaScript>
var EventsDesc = new Array();
var EventsURL = new Array();
var sysnotice = '<s:property value="#request.sysNoticeList"/>';
<s:iterator value="#request.sysNoticeList" status="ind">
EventsDesc['<s:property value="#ind.index"/>']='<s:property value="#request.sysNoticeList[#ind.index].noticeTitle"/>';
var id = '<s:property value="#request.sysNoticeList[#ind.index].sysnoticeId"/>';
id ='showNotice(\''+id+'\');';
EventsURL['<s:property value="#ind.index"/>']=id;
</s:iterator>
var no=0, etLeftMargin=580, etMainWidth=750;
var eventsTickerID, isNavRunning = false;
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
if (isNav) {
var x = etLeftMargin + Math.floor((window.outerWidth - etMainWidth) / 2);
x = (x < etLeftMargin) ? etLeftMargin : x;
}
if(isNav) {
var desc = '<layer id="wds" top=130 left=' + x + ' width=150></layer>'
document.getElementById("notice").innerHTML=desc;
} else {
var desc = '<span id="wds"></span>';
document.getElementById("notice").innerHTML=desc;
}
function hResetX(e) {
if (isNav) {
//isNavRunning = false;
x = etLeftMargin + Math.floor((window.outerWidth - etMainWidth) / 2);
x = (x < etLeftMargin) ? etLeftMargin : x;
document.wds.left = x;
//window.reload();
}
}
function hLoad(e) {
if (!isNavRunning) {
isNavRunning = true;
eventsTickerID = setTimeout("EventsTicker();", 500);
}
if (isNav) {
window.captureEvents(Event.RESIZE);
window.onresize = hResetX;
}
}
function EventsTicker() {
desc = "<span style=\"cursor:pointer;width:50px;height:25px;\" onclick=\"" + EventsURL[no] + "\" >" + EventsDesc[no] + "</span>";
if(isNav) {
document.wds.document.write(desc);
document.wds.document.close();
} else {
wds.innerHTML = desc;
}
no = (no >= EventsDesc.length-1) ? 0 : ++no;
eventsTickerID = setTimeout("EventsTicker();", 2000);
alert(no+"=="+EventsDesc.length);
}
//EventsTicker();
//eventsTickerID = setTimeout("EventsTicker();", 200);
// catch the events for my own handler
if (document.layer) window.captureEvents(Event.LOAD);
window.onload = hLoad;
// -->
</SCRIPT>
文章格式顯示:
<table width="100%" class="table_tb" style="table-layout:fixed;word-break:break-all" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%" align="center">${sysNotice.noticeTitle}</td>
</tr>
<tr align="center">
<td width="80%" align="right"><s:date name="sysNotice.sendTime" format="yyyy年MM月dd日 HH:mm"/></td>
</tr>
<tr>
<td width="80%" align="left" style="word-wrap:break-word;word-break:normal;">
<pre><p style="text-indent: 2em">${sysNotice.noticeContent }</p></pre>
</td>
</tr>
</table>
3、js 網頁置頂var btn= null ;
function backTop(btnId){
btn=document.getElementById(btnId);
var d=document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
window.onscroll=set;
btn.onclick=myScroll;
/**function (){
btn.style.display="none";
window.onscroll=null;
setInterval(function(){
d.scrollTop-=Math.ceil(d*1);
if(d==0) clearInterval(btn.timer,window.onscroll=set);
},100);
d.scrollTop-=Math.ceil(d*1);
};**/
} function set(){var d=document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; var str = d>0?'block':'none';
btn.style.display=str ; // window.onscroll=null;
}
function myScroll()
{
//前邊是擷取chrome等一般瀏覽器 如果擷取不到就是ie了 就用ie的辦法擷取
var x=document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
var timer=setInterval(function(){
x=x-100;
if(x<100)
{
btn.style.display='none';
x=0;
window.scrollTo(x,x);
clearInterval(timer);
window.onscroll=set;
}
window.scrollTo(x,x);
},"10");
}
3、js 壓縮解壓工具 http://js.clicki.cc/4、jquery 彈出框工具http://code.google.com/p/artdialog/downloads/list5、jquery表單驗證提交http://www.skygq.com/ci/skygq_check_ajax_form_1_2.html6、html5 http://www.zhangxinxu.com