软件艺术思考者  
混沌,彷徨,立志,蓄势...
公告
日历
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

随笔分类(86)

随笔档案(85)

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 
0:字串转换成日期
var myDate=new   Date("2002-01-02".replace(/\-/g,'/'));  
alert(myDate.toLocaleString());

1.textarea宽度固定,自动增高,input高度固定,自动增宽

input高度固定,自动增宽<br>
<input  type="text"  style="width:60;overflow-x:visible;overflow-y:visible;">

<br>
textarea宽度固定,自动增高<br>

<textarea  type="text"  style="width:260;overflow-x:visible;overflow-y:visible;"></textarea>
2.验证是不是为汉字或者字母或者数字(正规字符)

var exp1="^([0-9A-Za-z]|[\u4e00-\u9fa5])+$";
     var corName=document.getElementById("displayName");
     if(corName.value==""||!corName.value.match(exp1)){
     document.getElementById("displayNameInfo").innerHTML="<font color='red' >显示名不能为空且只能为字母和汉字组成</font>";
     corName.focus();
     return false;
     }
posted on 2007-09-18 15:14 智者无疆 阅读(1059) 评论(16)  编辑  收藏 所属分类: Client teachnolgy research
评论:
  • # re: CSS/JS/HTML技巧[未登录]  lijun Posted @ 2007-09-20 11:30
    过滤所有的回车换行
    content=content.replace(/\r\n/ig,"");  回复  更多评论   

  • # re: CSS/JS/HTML技巧[未登录]  lijun Posted @ 2007-09-20 11:32
    过滤所有的空格
    }
    function LTrim(str){ //去掉字符串 的头空格
    var i;
    for(i=0;i<str.length; i++) {
    if(str.charAt(i)!=" ") break;
    }
    str = str.substring(i,str.length);
    return str;
    }

    function RTrim(str){
    var i;
    for(i=str.length-1;i>=0;i--){
    if(str.charAt(i)!=" "&&str.charAt(i)!=" ") break;
    }
    str = str.substring(0,i+1);
    return str;
    }
    function Trim(str){
    return LTrim(RTrim(str));
    }
      回复  更多评论   

  • # re: CSS/JS/HTML技巧[未登录]  lijun Posted @ 2007-09-20 11:33
    javascript 设置cookie
    // --- 设置cookie
    function setCookie(sName,sValue,expireHours) {alert('怩双杂');
    var cookieString = sName + "=" + escape(sValue);
    //;判断是否设置过期时间
    if (expireHours>0) {
    var date = new Date();
    date.setTime(date.getTime + expireHours * 3600 * 1000);
    cookieString = cookieString + "; expire=" + date.toGMTString();
    }
    document.cookie = cookieString;
    }

    //--- 获取cookie
    function getCookie(sName) {
    var aCookie = document.cookie.split("; ");
    for (var j=0; j < aCookie.length; j++){
    var aCrumb = aCookie[j].split("=");
    if (escape(sName) == aCrumb[0])
    return unescape(aCrumb[1]);
    }
    return null;
    }  回复  更多评论   

  • # re: CSS/JS/HTML技巧[未登录]  lijun Posted @ 2007-09-20 11:45
    日历控件的使用
    <SCRIPT language=javascript src="输入信息.files/calendarNew.js"></SCRIPT>

    <SCRIPT language=javascript src="输入信息.files/common.js"></SCRIPT>

    <SCRIPT language=javascript>
    function check(){
    // b=true;
    if(trim($('startdate').value)=="" ){
    alert("请选择起始日期!");
    $('startdate').select();
    return;
    //if((select_form.startdate.value=="" && select_form.enddate.value!="")
    // || (select_form.startdate.value!="" && select_form.enddate.value=="") ){
    // alert("起始日期和结束日期必须同时选择");
    // b=false;
    //}
    }else if(trim($('enddate').value)==""){
    alert("请选择结束日期!");
    $('startdate').select();
    return;
    }else if(!checkDate(trim($('startdate').value))){
    alert("起始日期格式错误!20yy-mm-dd");
    $('startdate').select();
    return ;
    }else if(!checkDate(trim($('enddate').value))){
    alert("结束日期格式错误!20yy-mm-dd");
    $('enddate').select();
    return;
    }else if("2007-09-20">trim($('startdate').value) || "2007-09-20">trim($('enddate').value)){
    alert("您选择的起始日期或结束日期早于产品创建日期,请重新选择日期!");
    return;
    }else if(trim($('startdate').value)>trim($('enddate').value)){
    alert("您选择的起始日期大于结束日期!");
    return;
    }


    <META content=万里播 name=Author>
    <META content="万里播 vonibo.com 版权所有" name=Copyright><LINK href="/favicon.ico"
    type=image/x-icon rel=icon><LINK href="/favicon.ico" type=image/x-icon
    rel="shortcut icon"><LINK href="输入信息.files/bar_menu.css" type=text/css
    rel=stylesheet>
    <SCRIPT src="输入信息.files/menu.js" type=text/javascript></SCRIPT>

    <SCRIPT src="输入信息.files/common.js" type=text/javascript></SCRIPT>

    <META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
    <BODY>
    <SCRIPT type=text/javascript>
    mmLoadMenus();
    function topsearch(pid){
    keyword=trim(document.getElementById("tobsearch").value);
    if(keyword.length!=0){
    filter=/^[^`~!@#$%^&*()+=|\\\][\]\{\}:;\,.<>/?]{1}[^`~!@$%^&()+=|\\\][\]\{\}:;\,.<>?]{0,19}$/;
    if(!filter.test(keyword)){
    alert("请输入正确的关键字");
    }else{
    url="/app/search?keyword="+keyword;
    if(pid!=0){
    url+="&pid="+pid;
    }
    location.href=url;
    }
    }else{
    alert("搜索关键字不能为空");
    }
    }
    </SCRIPT>

    <DIV id=head_box>
    <DIV class=toplogo></DIV>
    </DIV>
    <DIV id=center><FORM id=frm style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px" name=frm action=#
    method=post><DIV class=dzcl_box3_box><DIV class=dzcl_box3
    style="BORDER-RIGHT: #b7d6eb 1px solid; BORDER-TOP: #b7d6eb 1px solid; BORDER-LEFT: #b7d6eb 1px solid; BORDER-BOTTOM: #b7d6eb 1px solid"><DIV class=dzcl_box2_box3>
    <DIV class=dzcl_box2_box3_2> 开始时间: <LABEL><INPUT id=startdate
    onfocus="setday(this,'dataA1')" maxLength=10 size=10 name=startdate> </LABEL><A
    href="javascript:void(0)"><IMG id=dataA1
    onclick="document.getElementById('startdate').focus();return false" height=12
    alt=选择日期 src="输入信息.files/lib_icon_date.gif" width=15 align=absMiddle
    border=0></A> 结束时间: <LABEL><INPUT id=enddate onFocus="setday(this,'dataA2')"
    maxLength=10 size=10 name=enddate> <A href="javascript:void(0)"><IMG id=dataA2
    onclick="document.getElementById('enddate').focus();return false" height=12
    src="输入信息.files/lib_icon_date.gif" width=15 align=absMiddle
    border=0></A></LABEL> </DIV></DIV><!--在线策略-->
    <DIV class=dzcl_box2_box4 id=onlinePolicy>
    <DIV class=dzcl_box2_box3_1></DIV>
    </DIV></DIV></DIV></FORM></DIV>
    </BODY></HTML>
      回复  更多评论   

  • # re: CSS/JS/HTML技巧  智者无疆 Posted @ 2007-09-20 11:46
    document.write("<style>");
    document.write("#__calendar{width:147px;margin:0;padding:0;}");
    document.write("#calendarTable{ margin:0;padding:0;border:1px solid #000;}");
    document.write("th,td{margin:0;padding:0px}");
    document.write("#calendarTable th ,#calendarTable td{font:12px/20px 宋体,Arial,sans-serif;text-align:center;}");
    document.write("#calendarTable thead th.week{border-top:1px solid #CCC;border-bottom:1px solid #ccc;background:#EEE;}");
    document.write("#calendarTable thead tr.function th{border:1px solid #fff}");
    document.write("#calendarTable thead tr.topTime{letter-spacing:1px;}");
    document.write("#calendarTable thead a{color:#000;width:19px;height:18px;text-decoration:none;display:block;border:1px solid #ccc;background:#E1F1FF;}");
    document.write("#calendarTable tbody a:hover{color:#990;width:19px;height:18px;text-decoration:none;display:block;border:1px solid #ccc;background:#E1F1FF;}");
    document.write("#calendarTable thead a.today{width:98% !important;width:100%}");
    document.write("#calendarTable thead a.today:hover{width:98% !important;width:100%}");
    document.write("#calendarTable td{width:21px;height:20px;border-bottom:1px solid #E6E6E6;color:#fff;}");
    document.write("#calendarTable th{height:21px;}");
    document.write("#calendarTable tr.com{background:#fff;}");
    document.write("#calendarTable tr.cur{background:#F0FAFF;}");
    document.write("#calendarTable tbody a{color:#000;width:19px;height:18px;text-decoration:none;display:block;border:1px solid #fff;}");
    document.write("#calendarTable tbody a:hover{color:#990;width:19px;height:18px;text-decoration:none;border:1px solid #E6E6E6;background:#E1F1FF;display:block;}");
    document.write("#calendarTable tbody a.today{color:#c00;border:1px solid #DBDBDB;background:#CCE4FF;}");
    document.write("#calendarTable tbody a.today:hover{color:#990;border:1px solid #DBDBDB;background:#CCE4FF;}");
    document.write("#calendarTable tbody a.week{color:#c00;}");
    document.write("</style>");
    document.write("<div id='__calendar' style='position:absolute;display:none;background-color: #FFFFFF;'></div>");
    document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"calendarTable\"><thead><tr class=\"topTime\"><th>&nbsp;</th><th colspan=\"5\" id=\"sohwdate\"></th><th><a href=\"javascript:void(0);\" title=\"close\" onclick=\"shut()\">×</a></th></tr><tr class=\"function\"><th><a href=\"javascript:void(0);\" title=\"向前翻1年\" onclick=\"preYear()\">&lt;&lt;</a></th><th><a href=\"javascript:void(0);\" title=\"向前翻1月\" onclick=\"preMonth()\">&lt;</a></th><th colspan=\"3\"><a href=\"javascript:void(0);\" class=\"today\" title=\"今天\" onclick=\"getDate('0')\">今天</a></th><th><a href=\"javascript:void(0);\" title=\"向后翻1月\" onclick=\"nextMonth()\">&gt;</a></th><th><a href=\"javascript:void(0);\" title=\"向后翻1年\" onclick=\"nextYear()\">&gt;&gt;</a></th></tr><tr><th class=\"week\">日</th><th class=\"week\">一</th><th class=\"week\">二</th><th class=\"week\">三</th><th class=\"week\">四</th><th class=\"week\">五</th><th class=\"week\">六</th></thead><tbody id=\"calendarTbody\"></tbody></table>");

    var objouter;
    var objInput;
    var but1;
    var isShow = true;
    objouter=document.getElementById("__calendar");
    var calendarTable = document.getElementById("calendarTable");
    objouter.appendChild(calendarTable);

    function setday(obj,bt1){

    //alert(obj.id);
    but1=document.getElementById(bt1);
    objInput = obj;
    top1=getAbsoluteHeight(objInput)+getAbsoluteTop(objInput);
    top1+="px";
    writeDate();sohwDate();
    objouter.style.top =top1;
    objouter.style.left =getAbsoluteLeft(objInput)+"px";
    objouter.style.display = "block";}
    function getAbsoluteHeight(ob){return ob.offsetHeight;}
    function getAbsoluteWidth(ob){return ob.offsetWidth;}
    function getAbsoluteLeft(ob){var s_el=0;el=ob;while(el){s_el=s_el+el.offsetLeft;el=el.offsetParent;}; return s_el}
    function getAbsoluteTop(ob){var s_el=0;el=ob;while(el){s_el=s_el+el.offsetTop ;el=el.offsetParent;}; return s_el}



    var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    var toDay = new Date();
    var tempYear = toDay.getFullYear();
    var tempMonth = toDay.getMonth();
    var tbody = document.getElementById("calendarTbody");
    var sohwId = document.getElementById("sohwdate");
    function getDays(month, year)
    {
    if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? 29 : 28;
    else return daysInMonth[month];
    }

    function writeDate() {
    var curCal = new Date(tempYear,tempMonth ,1);
    var startDay = curCal.getDay();
    var daily = 0;
    var today = toDay.getDate();
    if(tempYear != toDay.getFullYear() || tempMonth != toDay.getMonth()) today = -1;
    var todayStyle = "";
    var weekEndStyle = "";
    clear();
    var intDaysInMonth =getDays(curCal.getMonth(), curCal.getFullYear());
    var weeks = (intDaysInMonth + startDay) % 7 == 0 ? (intDaysInMonth + startDay) / 7 : parseInt((intDaysInMonth + startDay ) / 7) + 1;

    for (var intWeek = 1; intWeek <= weeks; intWeek++){
    var tr = document.createElement("tr");
    tr.setAttribute("onmouseover","javascript:this.className='cur'");
    tr.setAttribute("onmouseout","javascript:this.className='com'");
    tr.onmouseover = function (){this.className = "cur";}
    tr.onmouseout = function (){this.className = "com";}
    for (var intDay = 0;intDay < 7;intDay++){
    var td = document.createElement("td");
    if ((intDay == startDay) && (0 == daily))
    daily = 1;

    if(today == daily) todayStyle="today";

    if (intDay == 6 || intDay == 0) weekEndStyle = "week" ;

    if ((daily > 0) && (daily <= intDaysInMonth))
    {
    td.innerHTML = "<a href=\"javascript:void(0);\" class=\""+ weekEndStyle + todayStyle +"\" onclick=\"getDate('"+daily+"')\" title=\""+eval(tempMonth+1)+"月"+daily+"日\">" + daily + "</a>";
    todayStyle = "";
    weekEndStyle = "";
    daily++;
    }else{
    td.innerHTML = "&nbsp;";
    todayStyle = "";
    weekEndStyle = "";
    }
    tr.appendChild(td);
    }
    tbody.appendChild(tr);
    }
    }
    function getDate(day){
    var year , month ,date;
    if(day == "0"){
    year = toDay.getFullYear();
    month = eval(toDay.getMonth()+1) < 10 ? "0"+eval(toDay.getMonth()+1) : eval(toDay.getMonth()+1);
    date = toDay.getDate() < 10 ? "0"+toDay.getDate() : toDay.getDate();
    }else{
    year = tempYear;
    month = eval(tempMonth+1) < 10 ? "0"+eval(tempMonth+1) : eval(tempMonth+1);
    date = day < 10 ? "0"+day : day;
    }
    objInput.value = year + "-" + month +"-"+ date;
    close();
    }
    function sohwDate(){
    sohwId.innerHTML = tempYear + "年" + eval(tempMonth+1) +"月";
    }
    function preYear(){
    isShow = false;
    if(tempYear > 999 && tempYear < 10000){
    tempYear--;
    }else{
    alert("年份超出范围(1000-9999)!");
    }
    sohwDate();
    writeDate();
    }
    function nextYear(){
    isShow = false;
    if(tempYear > 999 && tempYear < 10000){
    tempYear++;
    }else{
    alert("年份超出范围(1000-9999)!");
    }
    sohwDate();
    writeDate();
    }

    function preMonth(){
    isShow = false;
    if(tempMonth >= 1){tempMonth--}else{tempYear--;tempMonth = 11;}
    sohwDate();
    writeDate();
    }
    function nextMonth(){
    isShow = false;
    if(tempMonth == 11){tempYear++;tempMonth = 0}else{tempMonth++}
    sohwDate();
    writeDate();
    }
    function clear(){
    var nodes = tbody.childNodes;
    var nodesNum = nodes.length;
    for(var i=nodesNum-1;i>=0;i--) {
    tbody.removeChild(nodes[i]);
    }
    }
    function shut(){
    close();
    }
    function close(){
    tempYear = toDay.getFullYear();
    tempMonth = toDay.getMonth();
    objouter.style.display = "none"
    objouter.style.top = 0;
    objouter.style.left = 0;
    }
    function vent(event){

    if(document.all){
    if(isShow){
    if (window.event.srcElement != objouter && window.event.srcElement != objInput && window.event.srcElement !=but1) close();
    isShow = true;
    return;
    }
    isShow = true;
    }else{
    if(isShow){
    if(event.target != objouter && event.target != objInput && event.target != but1) close();
    isShow = true;
    }
    isShow = true;
    }
    }
    //document.onclick = vent;  回复  更多评论   

  • # 兼容ie,ff的点击复制和事件keyCode的使用[未登录]  lijun Posted @ 2007-09-20 18:00
    function CopyUrl(txt) { if(window.clipboardData)
    { window.clipboardData.clearData();
    window.clipboardData.setData("Text", txt); //alert("地址已复制!");
    document.body.scrollTop=0; }
    else if(navigator.userAgent.indexOf("Opera") != -1)
    { window.location = txt; } else if (window.netscape) {
    try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    } catch (e) {
    alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
    }
    var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance (Components.interfaces.nsIClipboard);
    if (!clip) return;
    var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) return; trans.addDataFlavor('text/unicode'); var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); var copytext = txt; str.data = copytext; trans.setTransferData("text/unicode",str,copytext.length*2); var clipid = Components.interfaces.nsIClipboard;
    if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } }




    function checkNum(event,aaab){
    var evt; //alert(aaab);
    if(event != null)
    evt = event; // For IE
    //alert(evt.keyCode);

    var code=evt.keyCode;
    if( (code<48||code>57)&&(code<96||code>105) ){
    alert('只能写整数1');document.getElementById(aaab).value='';return false;}
    //if(isNaN(this.value)){alert('只能写数字2');document.getElementById(id).value='';return false;}

    }

      回复  更多评论   

  • # re: CSS/JS/HTML技巧[未登录]  lijun Posted @ 2007-09-28 16:38
    //清空文件上传框
    function clearFileInput(file){
    var form=document.createElement('form');
    document.body.appendChild(form);
    //记住file在旧表单中的的位置
    var pos=file.nextSibling;
    form.appendChild(file);
    form.reset();
    pos.parentNode.insertBefore(file,pos);
    document.body.removeChild(form);
    }  回复  更多评论   

  • # javascript div 根据事件 重定位[未登录]  lijun Posted @ 2007-11-13 14:45
    <script language="javascript">
    function showDiv(obj)
    {
    linkDiv.style.left=getPosition(obj).x;
    linkDiv.style.top=getPosition(obj).y+obj.offsetHeight;
    linkDiv.style.position="absolute";
    linkDiv.style.display='';
    linkDiv.onmouseleave=function(){linkDiv.style.display='none'};
    }
    function getPosition(el)
    {
    for (var lx=0,ly=0;el!=null;lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
    return {x:lx,y:ly}
    }
    </script>
    <div id="linkDiv" style="display:none;width:100px;height:100px;border:1px #000000 solid"></div>
    <a href="" onmouseover="showDiv(this)">显示层1</a>
    <p> </p>
    <p> </p>
    <a href="" onmouseover="showDiv(this)">显示层2</a>  回复  更多评论   

  • # 嵌入flash[未登录]  lijun Posted @ 2007-12-13 09:47
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="900" height="600">
    <param name="movie" value="../../images_cn/demo/yslc1.swf" />
    <param name="quality" value="high" />
    <embed src="../../images_cn/demo/yslc1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="900" height="600"></embed>
    </object>  回复  更多评论   

  • # JS cookies最新方法  智者无疆 Posted @ 2008-01-14 15:23
    @lijun
    function setCookie2008_1(name, value,day) {
    str = name + "=" + escape(value);
    expires = day*24*60;
    exp=new Date();
    exp.setTime(exp.getTime() + expires*60*1000);
    str += "; expires="+exp.toGMTString();
    str += "; path=/";
    if(location.href.indexOf("docin.com")==-1){
    str += "; domain=.vonibo.com";
    }else{
    str += "; domain=.docin.com";
    }
    document.cookie = str;
    }
    //get cookie by cookie's name
    //name(String): cookie's name
    function getCookie2008_1(name){
    var tmp, reg = new RegExp("(^| )"+name+"=([^;]*)(;|$)","gi");
    if( tmp = reg.exec( unescape(document.cookie) ) )
    return(tmp[2]);
    return null;
    }  回复  更多评论   

  • # js_char_zhuzi  智者无疆 Posted @ 2008-02-20 17:06
    <script language=javascript>
    function table1(total,table_x,table_y,thickness,table_width,all_width,all_height,table_type){
    //参数含义(传递的数组,横坐标,纵坐标,柱子的厚度,柱子的宽度,图表的宽度,图表的高度,图表的类型)
    var tmdColor1 = new Array();
    tmdColor1[0] = "#d1ffd1";
    tmdColor1[1] = "#ffbbbb";
    tmdColor1[2] = "#ffe3bb";
    tmdColor1[3] = "#cff4f3";
    tmdColor1[4] = "#d9d9e5";
    tmdColor1[5] = "#ffc7ab";
    tmdColor1[6] = "#ecffb7";
    var tmdColor2 = new Array();
    tmdColor2[0] = "#00ff00";
    tmdColor2[1] = "#ff0000";
    tmdColor2[2] = "#ff9900";
    tmdColor2[3] = "#33cccc";
    tmdColor2[4] = "#666699";
    tmdColor2[5] = "#993300";
    tmdColor2[6] = "#99cc00";
    var tb_color = new Array(tmdColor1,tmdColor2);
    var line_color = "#69f";
    var left_width = 70;
    var length = thickness/2;
    var total_no = total[0].length;
    var temp1 = 0;
    var temp2,temp4,temp4;
    for(var i = 0;i<total_no;i++)
    {
    if(temp1<total[0][i])
    {
    temp1 = total[0][i];
    }
    }
    temp1 = parseInt(temp1.toString());
    if(temp1>9)
    {
    temp2 = temp1.toString().substr(1,1)
    if(temp2>4)
    {
    temp3 = (parseInt((temp1/(Math.pow(10,(temp1.toString().length-1)))).toString())+1)*Math.pow(10,(temp1.toString().length-1));
    }
    else
    {
    temp3 = (parseInt((temp1/(Math.pow(10,(temp1.toString().length-1)))).toString())+0.5)*Math.pow(10,(temp1.toString().length-1));
    }
    }
    else
    {
    if(temp1>4)
    temp3 = 10;
    else
    temp3 = 5;
    }
    temp4=temp3
    document.write("<!--[if gte vml 1]><v:rect id='_x0000_s1027' alt='' style='position:absolute;left:" + (table_x+left_width) + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:-1' fillcolor='#9cf' stroked='f'><v:fill rotate='t' angle='-45' focus='100%' type='gradient'/></v:rect><![endif]-->");
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width) + "px," + (table_y+all_height) + "px' to='" + (table_x+all_width+left_width) + "px," + (table_y+all_height) + "px'/><![endif]-->");
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width) + "px," + table_y + "px' to='" + (table_x+left_width) + "px," + (table_y+all_height) + "px'/><![endif]-->");

    switch (table_type)
    {
    case "A":

    var table_space = (all_width-table_width*total_no)/total_no;
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width+length) + "px,"+ table_y + "px' to='" + (table_x+left_width+length) + "px," + (table_y+all_height-length) + "px' strokecolor='" + line_color + "'/><![endif]-->");

    for(var i=0;i<=all_height-1;i+= all_height/5)
    {
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width)+ "px," + (table_y+all_height-length-i) + "px' to='" + (table_x+left_width+length) + "px," + (table_y+all_height-i) +"px' strokecolor='" + line_color + "'/><![endif]-->");
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width+length) + "px," + (table_y+all_height-length-i) + "px' to='" + (table_x+all_width+left_width) + "px," + (table_y+all_height-length-i) + "px' strokecolor='" + line_color + "'/><![endif]-->");
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+(left_width-15)) + "px," + (table_y+i) + "px' to='" + (table_x+left_width) + "px," + (table_y+i) + "px'/><![endif]-->");
    document.write("<!--[if gte vml 1]>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + table_x + "px;top:" + (table_y+i) + "px;width:" + left_width + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>" + temp4 + "</td></tr></table></v:textbox></v:shape><![endif]-->");
    temp4 = temp4-temp3/5;
    }
    for(var i=0;i<total_no;i++)
    {

    var temp_space = table_x + left_width + table_space / 2 + table_space * i + table_width * i;
    document.write("<v:rect id='_x0000_s1025' alt='' style='position:absolute;left:");
    document.write(temp_space);
    document.write("px;top:");
    document.write(table_y + all_height * (1 - (total[0][i] / temp3)));
    document.write("px;width:" + table_width + "px;height:" + all_height * (total[0][i] / temp3) + "px;z-index:1' fillcolor='" + tb_color[1][i] + "'>");
    document.write("<v:fill color2='" + tb_color[0][i] + "' rotate='t' type='gradient'/>")
    document.write("<o:extrusion v:ext='view' backdepth='" + thickness + "pt' color='" + tb_color[1][i] + "' on='t'/>");
    document.write("</v:rect>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + temp_space + "px;top:" + (table_y+all_height*(1-(total[0][i]/temp3))-table_width) + "px;width:" + (table_space+15) + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='center'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (temp_space-table_space/2) + "px;top:" + (table_y+all_height+1) + "px;width:" + (table_space+table_width) + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='center'>" + total[1][i] + "</td></tr></table></v:textbox></v:shape>");
    }

    break;
    case "B":
    var table_space = (all_height - table_width * total_no) / total_no;
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width+length) + "px," + (table_y+all_height-length) + "px' to='" + (table_x+left_width+all_width) + "px," + (table_y+all_height-length) + "px' strokecolor='" + line_color + "'/><![endif]-->");
    for(var i=0;i<=all_width-1;i +=all_width/5)
    {
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width+i) + "px," + (table_y+all_height-length) + "px' to='" + (table_x+left_width+length+i) + "px," + (table_y+all_height) + "px' strokecolor='" + line_color + "'/><![endif]-->");
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width+length+i) + "px," + (table_y+all_height-length) + "px' to='" + (table_x+left_width+length+i) + "px," + table_y + "px' strokecolor='" + line_color + "'/><![endif]-->");
    document.write("<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x+left_width+i+all_width/5) + "px," + (table_y+all_height) + "px' to='" + (table_x+left_width+i+all_width/5) + "px," + (table_y+all_height+15) + "px'/><![endif]-->");
    document.write("<!--[if gte vml 1]>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x+left_width+i+all_width/5-left_width) + "px;top:" + (table_y+all_height) + "px;width:" + left_width + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>" + temp4 + "</td></tr></table></v:textbox></v:shape><![endif]-->");
    temp4 = temp4 - temp3 / 5;
    }

    for(var i=0;i<total_no;i++)
    {
    var temp_space = table_space/2 + table_space * i + table_width * i;
    document.write("<v:rect id='_x0000_s1025' alt='' style='position:absolute;left:");
    document.write(table_x + left_width);
    document.write("px;top:");
    document.write(table_y + temp_space);
    document.write("px;width:" + all_width * (total[0][i] / temp3) + "px;height:" + table_width + "px;z-index:1' fillcolor='" + tb_color[1][i] + "'>");
    document.write("<v:fill color2='" + tb_color[0][i] + "' rotate='t' angle='-90' focus='100%' type='gradient'/>");
    document.write("<o:extrusion v:ext='view' backdepth='" + thickness + "pt' color='" + tb_color[1][i] + "' on='t'/>");
    document.write("</v:rect>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + left_width + all_width * (total[0][i] / temp3) + thickness / 2) + "px;top:" + (table_y + temp_space) + "px;width:" + (table_space + 15) + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='center'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");

    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + table_x + "px;top:" + (table_y + temp_space) + "px;width:" + left_width + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>" + total[1][i] + "</td></tr></table></v:textbox></v:shape>");
    }

    }
    }
    </script>
    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
    <!--[if !mso]>
    <style>
    v\:* { behavior: url(#default#VML) }
    o\:* { behavior: url(#default#VML) }
    .shape { behavior: url(#default#VML) }
    </style>
    <![endif]-->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    <style>
    TD { FONT-SIZE: 9pt}
    </style></head>
    <body topmargin=5 leftmargin=0 scroll=AUTO>
    <script language=javascript>
    //=============调用方法=====================
    var dataArray = new Array()
    dataArray[0]=200
    dataArray[1]=800
    dataArray[2]=1000
    dataArray[3]=600
    dataArray[4]=1222
    dataArray[5]=3213
    dataArray[6]=8
    var nameArray = new Array()
    nameArray[0]="中国经营报"
    nameArray[1]="招聘网"
    nameArray[2]="51Job"
    nameArray[3]="新民晚报"
    nameArray[4]="新闻晚报"
    nameArray[5]="南方周末"
    nameArray[6]="羊城晚报"
    var total= new Array(dataArray,nameArray)
    table1(total,200,20,20,30,400,200,"A");
    table1(total,200,320,20,20,400,250,"B")
    </script>
    </body>
    </html>
      回复  更多评论   

  • # js_chart_pie  智者无疆 Posted @ 2008-02-20 17:07
    <script language=javascript>
    function table3(total,table_x,table_y,all_width,all_height,table_type)
    {
    //参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,图表的类型)
    var tmdColor1 = new Array();

    tmdColor1[0] = "#d1ffd1";
    tmdColor1[1] = "#ffbbbb";
    tmdColor1[2] = "#ffe3bb";
    tmdColor1[3] = "#cff4f3";
    tmdColor1[4] = "#d9d9e5";
    tmdColor1[5] = "#ffc7ab";
    tmdColor1[6] = "#ecffb7";

    var tmdColor2 = new Array();

    tmdColor2[0] = "#00ff00";
    tmdColor2[1] = "#ff0000";
    tmdColor2[2] = "#ff9900";
    tmdColor2[3] = "#33cccc";
    tmdColor2[4] = "#666699";
    tmdColor2[5] = "#993300";
    tmdColor2[6] = "#99cc00";

    var tb_color = new Array(tmdColor1,tmdColor2);
    var tb_height = 30;
    var total_no = total[0].length;
    var totalpie = 0;
    for(var i=0;i<total_no;i++)
    {
    totalpie += total[1][i];
    }
    var PreAngle = 0;
    for(var i=0;i<total_no;i++)
    {
    document.write("<v:shape id='_x0000_s1025' alt='' style='position:absolute;left:" + table_x + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:1' coordsize='1500,1400' o:spt='100' adj='0,,0' path='m750,700ae750,700,750,700," + parseInt(23592960*PreAngle) + "," + parseInt(23592960*total[1][i]/totalpie) + "xe' fillcolor='" + tb_color[0][i] + "' strokecolor='#FFFFFF'><v:fill color2='" + tb_color[1][i] + "' rotate='t' focus='100%' type='gradient'/><v:stroke joinstyle='round'/><v:formulas/><v:path o:connecttype='segments'/></v:shape>");
    PreAngle += total[1][i] / totalpie;
    }

    if(table_type=="A")
    {
    document.write("<v:rect id='_x0000_s1025' style='position:absolute;left:" + (table_x + all_width + 20) + "px;top:" + (table_y + 20) + "px;width:100px;height:" + (total_no * tb_height + 20) + "px;z-index:1'/>");
    for(var i=0;i<total_no;i++)
    {
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + all_width + 25) + "px;top:" + (table_y+30+(i)*tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");
    document.write("<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:" + (table_x + all_width + 80) + "px;top:" + (table_y + 30 + (i)*tb_height+3) + "px;width:30px;height:20px;z-index:1' fillcolor='" + tb_color[0][i] + "'><v:fill color2='" + tb_color[1][i] + "' rotate='t' focus='100%' type='gradient'/></v:rect>");
    //显示比例数
    //document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x+all_width+110) + "px;top:" + (table_y+30+(i)*tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
    //document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + Math.round(parseFloat(total[1][i]*100/totalpie)*100)/100 + "%</td></tr></table></v:textbox></v:shape>");
    }
    }

    if(table_type == "B")
    {
    var pie = 3.14159265358979;
    var TempPie = 0;
    for(var i=0;i<total_no;i++)
    {
    var TempAngle = pie * 2 * (total[1][i] / (totalpie * 2) + TempPie);
    var x1 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/8;
    var y1 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/8;
    var x2 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/4;
    var y2 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/4;

    if(x2>table_x + all_width/2)
    {
    x3 = x2 + 20;
    x4 = x3;
    }
    else
    {
    x3 = x2 - 20;
    x4 = x3 - 100;
    }
    document.write("<v:oval id='_x0000_s1027' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='#111111' strokecolor='#111111'/>");
    document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x1 + "px," + y1 + "px' to='" + x2 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>");
    document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x2 + "px," + y2 + "px' to='" + x3 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + x4 + "px;top:" + (y2 - 10) + "px;width:100px;height:20px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + " " + Math.round(parseFloat(total[1][i] * 100/ totalpie)*100)/100 + "%</td></tr></table></v:textbox></v:shape>")
    TempPie += total[1][i]/totalpie;
    }
    }
    }
    </script>
    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
    <!--[if !mso]>
    <style>
    v\:* { behavior: url(#default#VML) }
    o\:* { behavior: url(#default#VML) }
    .shape { behavior: url(#default#VML) }
    </style>
    <![endif]-->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    <style>
    TD { FONT-SIZE: 9pt}
    </style></head>
    <body topmargin=5 leftmargin=0 scroll=AUTO>
    <script language=javascript>
    //=============调用方法=====================
    var dataArray = new Array()
    dataArray[0]=200
    dataArray[1]=1200
    dataArray[2]=900
    dataArray[3]=600
    dataArray[4]=1222
    dataArray[5]=413
    dataArray[6]=800
    var nameArray = new Array()
    nameArray[0]="中国经营报"
    nameArray[1]="招聘网"
    nameArray[2]="51Job"
    nameArray[3]="新民晚报"
    nameArray[4]="新闻晚报"
    nameArray[5]="南方周末"
    nameArray[6]="羊城晚报"
    var total= new Array(nameArray,dataArray)
    //table3(total,200,40,250,250,"A");
    table3(total,300,450,250,250,"B");
    </script>
    </body>
    </html>
      回复  更多评论   

  • # js_chart_zhexian  智者无疆 Posted @ 2008-02-20 17:08
    <script language=javascript>
    function table2(total,table_x,table_y,all_width,all_height,line_no)
    {
    //参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,折线条数)
    //纯ASP代码生成图表函数2——折线图
    //作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com
    //本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨
    //版本1.0 最后修改日期 2003-8-11
    //非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。
    //***************************************************************************************
    //修改说明:
    // 本代码经原作者同意,由 awaysrain(绝对零度)修改为javascript。
    // 最后修改日期 2003-9-22,测试环境为IE 6.0.2500.1106
    // 因本人水平有限,修改中难免有错误,请大家及时指正。
    //***************************************************************************************
    var line_color = "#69f";
    var left_width = 70;
    var total_no = total[1].length
    var temp1,temp2,temp3
    temp1 = 0;
    for(var i=1;i<total_no;i++)
    {
    for(var j=1;j<=line_no;j++)
    {
    if(temp1<total[j][i])
    temp1 = total[j][i];
    }
    }
    temp1 = parseInt(temp1);
    if(temp1>9)
    {
    temp2 = temp1.toString().substr(1,1);
    if(temp2>4)
    {
    temp3 = (parseInt(temp1/(Math.pow(10,(temp1.toString().length-1))))+1)*Math.pow(10,(temp1.toString().length-1));
    }
    else
    {
    temp3 = (praseInt(temp1/(Math.pow(10,(temp1.toString().length-1))))+0.5)*Math.pow(10,(temp1.toString().length-1))
    }
    }
    else
    {
    if(temp1>4)
    {
    emp3 = 10;
    }
    else
    {
    temp3 = 5;
    }
    }
    temp4 = temp3;
    document.write("<v:rect id='_x0000_s1027' alt='' style='position:absolute;left:" + (table_x + left_width) + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:-1' fillcolor='#9cf' stroked='f'><v:fill rotate='t' angle='-45' focus='100%' type='gradient'/></v:rect>");
    for(var i=0;i<all_height;i += all_height/5)
    {
    document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width + length) + "px," + (table_y + all_height - length - i) + "px' to='" + (table_x + all_width + left_width) + "px," + (table_y + all_height - length - i) + "px' strokecolor='" + line_color + "'/>");
    document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + (left_width - 15)) + "px," + (table_y + i) + "px' to='" + (table_x + left_width) + "px," + (table_y + i) + "px'/>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + table_x + "px;top:" + (table_y + i) + "px;width:" + left_width + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>" + temp4 + "</td></tr></table></v:textbox></v:shape>");
    temp4 = temp4 - temp3/5;
    }
    document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width) + "px," + (table_y + all_height) + "px' to='" + (table_x + all_width + left_width) + "px," + (table_y + all_height) + "px'/>");
    document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width) + "px," + table_y + "px' to='" + (table_x + left_width) + "px," + (table_y + all_height) + "px'/>");
    var tmpStr = ""
    for(i=1;i<=line_no;i++)
    {
    var re = /,/g;
    tmpStr += ",[\"" + total[i][0].replace(re,"\",\"") + "\"]"
    }
    tmpStr = tmpStr.substr(1,tmpStr.length-1)
    var line_code = eval("new Array(" + tmpStr + ")")
    for(var j=1;j<=line_no;j++)
    {
    for(var i=1;i<total_no-1;i++)
    {
    var x1 = table_x + left_width + all_width * (i - 1)/(total_no-1)
    var y1 = table_y + (temp3 - total[j][i]) * (all_height/temp3)
    var x2 = table_x + left_width + all_width * i/(total_no-1)
    var y2 = table_y + (temp3 - total[j][i+1]) * (all_height/temp3)

    document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x1 + "px," + y1 + "px' to='" + x2 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='" + line_code[j-1][0] + "' strokeweight='" + line_code[j-1][1] + "'>");
    switch (parseInt(line_code[j-1][2]))
    {
    case 1:
    break;
    case 2:
    document.write("<v:stroke dashstyle='1 1'/>");
    break;
    case 3:
    document.write("<v:stroke dashstyle='dash'/>");
    break;
    case 4:
    document.write("<v:stroke dashstyle='dashDot'/>");
    break;
    case 5:
    document.write("<v:stroke dashstyle='longDash'/>");
    break;
    case 6:
    document.write("<v:stroke dashstyle='longDashDot'/>");
    break;
    case 7:
    document.write("<v:stroke dashstyle='longDashDotDot'/>");
    break;
    }

    document.write("</v:line>");

    switch (parseInt(line_code[j-1][3]))
    {
    case 1:
    break;
    case 2:
    document.write("<v:rect id='_x0000_s1027' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
    break;
    case 3:
    document.write("<v:oval id='_x0000_s1026' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px;z-index:1' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
    break;
    }

    }
    switch (parseInt(line_code[j-1][3]))
    {
    case 1:
    break;
    case 2:
    document.write("<v:rect id='_x0000_s1027' style='position:absolute;left:" + (x2 - 2) + "px;top:" + (y2 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
    break;
    case 3:
    document.write("<v:oval id='_x0000_s1026' style='position:absolute;left:" + (x2 - 2) + "px;top:" + (y2 - 2) + "px;width:4px;height:4px;z-index:1' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
    break;
    }
    }

    for(var i=0;i<total_no-1;i++)
    {
    document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width + all_width * (i)/(total_no-1)) + "px," + (table_y + all_height) + "px' to='" + (table_x + left_width + all_width * (i)/(total_no-1)) + "px," + (table_y + all_height + 15) + "px'/>");
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + left_width + all_width * (i)/(total_no-1)) + "px;top:" + (table_y + all_height) + "px;width:" + (all_width/(total_no-1)) + "px;height:18px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");
    }
    var tb_height = 30
    document.write("<v:rect id='_x0000_s1025' style='position:absolute;left:" + (table_x + all_width + 20) + "px;top:" + table_y + "px;width:100px;height:" + (line_no * tb_height + 20) + "px;z-index:1'/>");
    for(var i=0;i<line_no;i++)
    {
    document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + all_width + 25) + "px;top:" + (table_y + 10+(i) * tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
    document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + line_code[i][4] + "</td></tr></table></v:textbox></v:shape>");
    document.write("<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:" + (table_x + all_width + 80) + "px;top:" + (table_y + 10+(i) * tb_height + 4) + "px;width:30px;height:20px;z-index:1' fillcolor='" + line_code[i][0] + "'><v:fill color2='" + line_code[i][0] + "' rotate='t' focus='100%' type='gradient'/></v:rect>");
    }
    }
    </script>
    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
    <!--[if !mso]>
    <style>
    v\:* { behavior: url(#default#VML) }
    o\:* { behavior: url(#default#VML) }
    .shape { behavior: url(#default#VML) }
    </style>
    <![endif]-->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    <style>
    TD { FONT-SIZE: 9pt}
    </style></head>
    <body topmargin=5 leftmargin=0 scroll=AUTO>
    <script language=javascript>
    var nameArray = new Array();
    nameArray[0]="中国经营报"
    nameArray[1]="招聘网"
    nameArray[2]="51Job"
    nameArray[3]="新民晚报"
    nameArray[4]="新闻晚报"
    nameArray[5]="南方周末"
    nameArray[6]="羊城晚报"
    var dataArray1 = new Array()
    dataArray1[0]="#FF0000,1.5,1,2,公司1"//参数1线条的颜色,参数2线条的宽度,参数3线条的类型,参数4转折点的类型,参数5线条名称
    dataArray1[1]=200
    dataArray1[2]=1200
    dataArray1[3]=900
    dataArray1[4]=600
    dataArray1[5]=1222
    dataArray1[6]=413
    dataArray1[7]=800
    var dataArray2 = new Array()
    dataArray2[0]="#0000FF,1,2,3,公司2"
    dataArray2[1]=400
    dataArray2[2]=500
    dataArray2[3]=1040
    dataArray2[4]=1600
    dataArray2[5]=522
    dataArray2[6]=813
    dataArray2[7]=980
    var dataArray3 = new Array()
    dataArray3[0]="#004D00,1,1,3,公司3"
    dataArray3[1]=900
    dataArray3[2]=890
    dataArray3[3]=1240
    dataArray3[4]=1300
    dataArray3[5]=722
    dataArray3[6]=833
    dataArray3[7]=1280
    var total = new Array(nameArray,dataArray1,dataArray2,dataArray3)
    table2(total,100,90,600,250,3);
    </script>
    </body>
    </html>
      回复  更多评论   

  • # js检查文件的大小[未登录]  lijun Posted @ 2008-04-17 17:02
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function ShowSize(files)
    {
    var fso,f;
    alert("我们会检查文件大小,请您允许Active交互");
    fso=new ActiveXObject("Scripting.FileSystemObject");
    f=fso.GetFile(files);
    var size=0;
    size=((f.size/1024)/1024).toFixed(2);
    var maxFileSize=2;
    if(size>maxFileSize){
    alert("对不起,你要上传的文件已经超过"+maxFileSize+"M,请重新选择");
    }else{
    alert("可以继续上传了");
    };
    }
    //-->
    </SCRIPT>

    <input type=file onchange="ShowSize(this.value)">  回复  更多评论   

  • # 带时分秒日历控件  智者无疆 Posted @ 2008-05-28 13:58
    //日历
    var date_start,date_end,g_object
    var today = new Date();
    var separator="-";
    var inover=false;

    //mode :时间变换的类型0-年 1-月 2-直接选择月
    function change_date(temp,mode)
    {
    var t_month,t_year
    if (mode){
    if(mode==1)
    t_month=parseInt(cele_date_month.value,10)+parseInt(temp,10);
    else
    t_month=parseInt(temp)
    if (t_month<cele_date_month.options(0).text) {
    cele_date_month.value=cele_date_month.options(cele_date_month.length-1).text;
    change_date(parseInt(cele_date_year.value,10)-1,0);
    }
    else{
    if (t_month>cele_date_month.options(cele_date_month.length-1).text){
    cele_date_month.value=cele_date_month.options(0).text;
    change_date(parseInt(cele_date_year.value,10)+1,0);
    }
    else
    {cele_date_month.value=t_month;
    set_cele_date(cele_date_year.value,cele_date_month.value);
    }
    }
    }
    else{
    t_year=parseInt(temp,10);

    if (t_year<cele_date_year.options(0).text) {
    cele_date_year.value=cele_date_year.options(0).text;
    set_cele_date(cele_date_year.value,1);
    }
    else{
    if (parseInt(t_year,10)>parseInt(cele_date_year.options(cele_date_year.length-1).text,10)){
    cele_date_year.value=cele_date_year.options(cele_date_year.length-1).text;
    set_cele_date(cele_date_year.value,12);
    }
    else
    {cele_date_year.value=t_year;
    set_cele_date(cele_date_year.value,cele_date_month.value);
    }
    }
    }
    /*********2002-02-01 MODIFY BY WING **************/
    window.cele_date.focus();
    /****************MODIFY END***********************/
    }

    //初始化日历
    function init(d_start,d_end)
    {
    var temp_str;
    var i=0
    var j=0
    date_start=new Date(1980,7,1)
    date_end=new Date(2004,8,1)
    document.writeln("<div name=\"cele_date\" id=\"cele_date\" style=\"display:none\" style=\"LEFT: 69px; POSITION: absolute; TOP: 159px;Z-INDEX:99\" onClick=\"event.cancelBubble=true;\" onBlur=\"hilayer()\" onMouseout=\"lostlayerfocus()\">-</div>");
    window.cele_date.innerHTML="";
    temp_str="<table border=\"1\" bgcolor=\"#DDDDDD\" bordercolor=\"white\"><tr><td colspan=7 onmouseover=\"overcolor(this)\">";
    temp_str+="<input type=\"Button\" value=\"<<\" onclick=\"change_date(-1,1)\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; background-color: #BFBFBF; cursor: hand\">-";

    temp_str+=""
    temp_str+="<select name=\"cele_date_year\" id=\"cele_date_year\" language=\"javascript\" onchange=\"change_date(this.value,0)\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"

    for (i=1900;i<=2020;i++)
    {
    temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
    }
    temp_str+="</select>-";
    temp_str+=""
    temp_str+="<select name=\"cele_date_month\" id=\"cele_date_month\" language=\"javascript\" onchange=\"change_date(this.value,2)\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"

    for (i=1;i<=12;i++)
    {
    temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
    }
    temp_str+="</select>-";
    temp_str+=""
    temp_str+="<input type=\"Button\" value=\">>\" onclick=\"change_date(1,1)\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; background-color: #BFBFBF; cursor: hand\">";

    temp_str+="</td></tr><tr><td onmouseover=\"overcolor(this)\">"
    temp_str+="<font color=red>日</font></td><td>";temp_str+="一</td><td>"; temp_str+="二</td><td>"; temp_str+="三</td><td>"
    temp_str+="四</td><td>";temp_str+="五</td><td>"; temp_str+="六</td></tr>";
    for (i=1 ;i<=6 ;i++)
    {
    temp_str+="<tr>";
    for(j=1;j<=7;j++){
    temp_str+="<td name=\"c"+i+"_"+j+"\"id=\"c"+i+"_"+j+"\" style=\"CURSOR: hand\" style=\"COLOR:#000000\" language=\"javascript\" onmouseover=\"overcolor(this)\" onmouseout=\"outcolor(this)\" onclick=\"td_click(this)\">?</td>"
    }
    temp_str+="</tr>"
    }
    temp_str+="</td></tr>";
    temp_str+="<tr><td colspan=7>";

    temp_str+="";
    temp_str+="<select name=\"cele_date_hour\" id=\"cele_date_hour\" language=\"javascript\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"
    for (i=0;i<24;i++)
    {
    temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
    }
    temp_str+="</select>:";
    temp_str+="";

    temp_str+="";
    temp_str+="<select name=\"cele_date_minute\" id=\"cele_date_minute\" language=\"javascript\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"
    for (i=0;i<60;i++)
    {
    temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
    }
    temp_str+="</select>:";
    temp_str+="";

    temp_str+="";
    temp_str+="<select name=\"cele_date_second\" id=\"cele_date_second\" language=\"javascript\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" style=\"font-size: 9pt; border: 1px #666666 outset; background-color: #F4F8FB\">"
    for (i=0;i<60;i++)
    {
    temp_str+="<OPTION value=\""+i.toString()+"\">"+i.toString()+"</OPTION>";
    }
    temp_str+="</select>";
    temp_str+="";

    temp_str+="</td></tr>";
    temp_str+="</table>";
    window.cele_date.innerHTML=temp_str;
    }
    function set_cele_date(year,month)
    {
    var i,j,p,k
    var nd=new Date(year,month-1,1);
    event.cancelBubble=true;
    cele_date_year.value=year;
    cele_date_month.value=month;
    k=nd.getDay()-1
    var temp;
    for (i=1;i<=6;i++)
    for(j=1;j<=7;j++)
    {
    eval("c"+i+"_"+j+".innerHTML=\"\"");
    eval("c"+i+"_"+j+".bgColor=\"#DDDDDD\"");
    eval("c"+i+"_"+j+".style.cursor=\"hand\"");
    }
    while(month-1==nd.getMonth())
    { j=(nd.getDay() +1);
    p=parseInt((nd.getDate()+k) / 7)+1;
    eval("c"+p+"_"+j+".innerHTML="+"\""+nd.getDate()+"\"");
    if ((nd.getDate()==today.getDate())&&(cele_date_month.value==today.getMonth()+1)&&(cele_date_year.value==today.getYear())){
    eval("c"+p+"_"+j+".bgColor=\"#EFFB64\"");
    }
    if (nd>date_end || nd<date_start)
    {
    eval("c"+p+"_"+j+".bgColor=\"#FF9999\"");
    eval("c"+p+"_"+j+".style.cursor=\"text\"");
    }
    nd=new Date(nd.valueOf() + 86400000);
    }
    }

    //s_object:点击的对象;d_start-d_end有效的时间区段;需要存放值的控件;
    function show_cele_date(d_start,d_end,t_object)
    {
    window.cele_date.style.display="";
    window.cele_date.style.zIndex=99;
    var s,cur_d
    var eT = t_object.offsetTop;
    var eH = t_object.offsetHeight+eT;
    var dH = window.cele_date.style.pixelHeight;
    var sT = document.body.scrollTop;
    var sL = document.body.scrollLeft;
    event.cancelBubble=true;
    window.cele_date.style.posLeft = event.clientX-event.offsetX+sL-5;
    window.cele_date.style.posTop = event.clientY-event.offsetY+eH+sT-5+document.documentElement.scrollTop;
    if (window.cele_date.style.posLeft+window.cele_date.clientWidth>document.body.clientWidth) window.cele_date.style.posLeft+=t_object.offsetWidth-window.cele_date.clientWidth;
    if (d_start!=""){
    if (d_start=="today"){
    date_start=new Date(today.getYear(),today.getMonth(),today.getDate());
    }else{
    s=d_start.split(separator);
    date_start=new Date(s[0],s[1]-1,s[2]);
    }
    }else{
    date_start=new Date(1900,1,1);
    }

    if (d_end!=""){
    s=d_end.split(separator);
    date_end=new Date(s[0],s[1]-1,s[2]);
    }else{
    date_end=new Date(3000,1,1);
    }

    g_object=t_object

    cur_d=new Date()
    set_cele_date(cur_d.getYear(),cur_d.getMonth()+1);
    window.cele_date.style.display="block";

    window.cele_date.focus();

    }
    function td_click(t_object)
    {
    var t_d
    if (parseInt(t_object.innerHTML,10)>=1 && parseInt(t_object.innerHTML,10)<=31 )
    { t_d=new Date(cele_date_year.value,cele_date_month.value-1,t_object.innerHTML)
    if (t_d<=date_end && t_d>=date_start)
    {
    var year = cele_date_year.value;
    var month = cele_date_month.value;
    var day = t_object.innerHTML;
    if (parseInt(month)<10) month = "0" + month;
    if (parseInt(day)<10) day = "0" + day;
    var hour = cele_date_hour.value;
    if (hour < 10) hour = "0" + hour;
    var minute = cele_date_minute.value;
    if (minute < 10) minute = "0" + minute;
    var second = cele_date_second.value;
    if (second < 10) second = "0" + second;
    g_object.value=year+separator+month+separator+day+" "+hour+":"+minute+":"+second;
    window.cele_date.style.display="none";};
    }

    }
    function h_cele_date()
    {
    window.cele_date.style.display="none";
    }

    function overcolor(obj)
    {
    if (obj.style.cursor=="hand") obj.style.color = "#FFFFFF";

    inover=true;
    window.cele_date.focus();

    }

    function outcolor(obj)
    {
    obj.style.color = "#000000";
    inover=false;

    }

    function getNow(o){
    var Stamp=new Date();
    var year = Stamp.getYear();
    var month = Stamp.getMonth()+1;
    var day = Stamp.getDate();
    if(month<10){
    month="0"+month;
    }
    if(day<10){
    day="0"+day;
    }
    o.value=year+separator+month+separator+day;
    }

    function hilayer()
    {
    if (inover==false)
    {
    var lay=document.all.cele_date;
    lay.style.display="none";
    }
    }
    function getlayerfocus()
    {
    inover=true;
    }
    function lostlayerfocus()
    {
    inover=false;
    }
    init();
    //日历结束
    //用例
    <input type="text" name="findDate" id="timeEnd" onfocus="show_cele_date('','',timeEnd)" maxlength="10" readonly="readonly" />  回复  更多评论   

  • # 简单表格的样式  zlj Posted @ 2008-10-21 10:59
    <table bordercolordark='#ffffff' bordercolorlight='#cccccc' align='center' cellpadding='0' cellspacing='0' border='1' style='padding:5px;line-height:21px;font-size:13px;'>  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © 智者无疆 Powered by: 博客园 模板提供:沪江博客


   观音菩萨赞