杂项(曾经的笔记本)_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 杂项(曾经的笔记本)

杂项(曾经的笔记本)

 2018/3/27 21:47:38  独孤不求败  程序员俱乐部  我要评论(0)
  • 摘要:----------------------------------------------------------------------------------Oracle创建普通用户,并赋予权限采用sysorsystem/managerassysdba;连接数据库。创建普通用户konglin:createuserkonglinidentifiedbypwd_oracle;删除用户,dropuserkonglin;授予用户登录数据库的权限
  • 标签:笔记 笔记本
----------------------------------------------------------------------------------
Oracle 创建普通用户,并赋予权限
采用sys or system / manager as sysdba; 连接数据库。
创建普通用户konglin: create user konglin identified by pwd_oracle;
删除用户, drop user konglin;
授予用户登录数据库的权限: grant create session to konglin;
授予用户操作表空间的权限:

grant unlimited tablespace to konglin;
grant create tablespace to konglin;
grant alter tablespace to konglin;
grant drop tablespace to konglin;
grant manage tablespace to konglin;
授予用户操作表的权限:

grant create table to konglin; (包含有create index权限, alter table, drop table权限)
授予用户操作视图的权限:
grant create view to konglin; (包含有alter view, drop view权限)
授予用户操作触发器的权限:
grant create trigger to konglin; (包含有alter trigger, drop trigger权限)
授予用户操作存储过程的权限:
grant create procedure to konglin;(包含有alter procedure, drop procedure 和function 以及 package权限)
授予用户操作序列的权限:
grant create sequence to konglin; (包含有创建、修改、删除以及选择序列)
授予用户回退段权限:
grant create rollback segment to konglin;
grant alter rollback segment to konglin;
grant drop rollback segment to konglin;
授予用户同义词权限:
grant create synonym to konglin;(包含drop synonym权限)
grant create public synonym to konglin;
grant drop public synonym to konglin;
授予用户关于用户的权限:
grant create user to konglin;
grant alter user to konglin;
grant become user to konglin;
grant drop user to konglin;
授予用户关于角色的权限:
grant create role to konglin;
授予用户操作概要文件的权限
grant create profile to konglin;
grant alter profile to konglin;
grant drop profile to konglin;
允许从sys用户所拥有的数据字典表中进行选择
grant select any dictionary to konglin;
-----------------------------------------------------------------------------------
wegov in
Query<Bo> query = Query.from(Bo.class);
query.filter(FilterOperator.IN, "id", ids);
-----------------------------------------------------------------------------------
远程ip端口测试
Telnet 116.236.146.102  80
-----------------------------------------------------------------------------------
SQL语句查询某表的所有字段及数据类型

SELECT  name AS column_name ,
        TYPE_NAME(system_type_id) AS column_type ,
        max_length ,
        is_nullable
FROM    sys.columns
WHERE   object_id = OBJECT_ID(N'customerbase')  --customerbase 为表名
-----------------------------------------------------------------------------------
1、修改字段名:
  alter table 表名 rename column A to B

2、修改字段类型:

  alter table 表名 alter column 字段名 type not null

3、修改字段默认值
  alter table 表名 add default (0) for 字段名 with values

  如果字段有默认值,则需要先删除字段的约束,在添加新的默认值,

  select c.name from sysconstraints a
  inner join syscolumns b on a.colid=b.colid
  inner join sysobjects c on a.constid=c.id
  where a.id=object_id('表名')
  and b.name='字段名'

  根据约束名称删除约束

  alter table 表名 drop constraint 约束名

  根据表名向字段中增加新的默认值

  alter table 表名 add default (0) for 字段名 with values

4、增加字段:

  alter table 表名 add 字段名 type not null default 0
alter table users add timeoutminute type not null default 1

5、删除字段:

  alter table 表名 drop column 字段名;
-----------------------------------------------------------------------------------
一个客户要求给网站添加一个背景音乐,我用的是html5添加网页背景音乐的代码,在此记录一下以后有用。
html5方法一:<audio autoplay="" loop=""><source src="http://mi.0w0.im/Letter_Song.mp3"></audio>不显示播放器。
html5方法二:<video controls="" autoplay="" name="media"><source src="我是音乐" type="audio/mpeg"></video>会显示播放器。
方法三:支持所有播放器:<embed src="/uploadfile/m.mp3" autostart="true" loop="true" hidden="true"></embed>我使用的此方法。
方法4:<bgsound src=背景音乐地址 loop=-1>
我使用的是方法三的代码,支持所有浏览器,方法1和2是html5的代码,有的浏览器还不支持html5所以慎用。特别注意的是使用方法3的代码,最好是把mp3传到自己的空间,网上找的外链,可能会出现自动下载的情况。
-----------------------------------------------------------------------------------
查询用户下表结构信息
SELECT t.table_name,
       t.colUMN_NAME,
       t.DATA_TYPE || '(' || t.DATA_LENGTH || ')',
       t1.COMMENTS
  FROM User_Tab_Cols t, User_Col_Comments t1
WHERE t.table_name = t1.table_name
    AND t.column_name = t1.column_name;
-----------------------------------------------------------------------------------
netstat -ano,列出所有端口的情况。
查看被占用端口对应的PID,输入命令:netstat -aon|findstr "49157",回车,记下最后一位数字,即PID,这里是2720
输入tasklist|findstr "2720",回车,查看是哪个进程或者程序占用了2720端口
-----------------------------------------------------------------------------------
创建索引:
 单一索引:Create Index <Index-Name> On <Table_Name>(Column_Name);

 复合索引: Create Index i_deptno_job on emp(deptno,job); —>在emp表的deptno、job列建立索引。
------------------------------------------------------------------------------------
js定时器
setTimeout(clear, 2000);
setInterval(clear, 30*60*1000);
------------------------------------------------------------------------------------
/**
* 计算时间差
* @param date1 被减数
* @param date2 减数
* @return
*/
public static String timeSubtraction(Date date1,Date date2) {
  long diff = date1.getTime() - date2.getTime();//这样得到的差值是微秒级别 
      long days = diff / (1000 * 60 * 60 * 24); 
      long hours = (diff-days*(1000 * 60 * 60 * 24))/(1000* 60 * 60); 
      long minutes = (diff-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60))/(1000* 60); 
      long second = (diff-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60)-minutes*(1000*60))/1000;
      long microsecond = diff%1000;
      String result = ""+days+"天"+hours+"小时"+minutes+"分"+second+"秒"+microsecond +"微妙";
      System.out.println(result); 
      return result;
}
/**
* 复制文件file1到file2
* @param file1 原文件
* @param file2 目标文件
* @throws IOException
*/
public static void copyFile(String file1,String file2)throws IOException{
  FileInputStream fis=new FileInputStream(file1);
  FileOutputStream fos=new FileOutputStream(file2);
  int temp;
  byte[] buff = new byte[1024];
  while((temp=fis.read(buff))!=-1){
   fos.write(buff,0,temp);
  }
  fis.close();
  fos.close();
  System.out.println("从"+file1+"到"+file2);
}

--------------------------------------------------------------------------------
oracle插入数据字段生成主键
insert into table1 t (ID)
select sys_guid() from table2 a
-------------------------------------------------------------------------------

<a href="javascript:void(0)" onclick="doSomething()">test</a>
------------------------------------------------------------------------------
create or replace procedure JOB_PRO_TEST as
begin
  delete table;--sql
end;
------------------------------------------------------------------------------
oracle 创建job
1
declare
job number;
begin
  --每天1440分钟,即一分钟运行test过程一次
  sys.dbms_job.submit(job,'job_pro_test;',sysdate,'TRUNC(sysdate,''mi'') + 2 / (24*60)');
end;
2
declare 
job number;
begin
    sys.dbms_job.submit( job  => job ,
    what => 'job_pro_test;',
    next_date => to_date('25-09-2017 14:39:00', 'dd-mm-yyyy hh24:mi:ss'),
    interval => 'sysdate+1/86400');--每天86400秒钟,即一秒钟运行prc_name过程一次
    commit;
end;
-----------------------------------------------------------------------------
js字符串转int
parserInt(string);
-----------------------------------------------------------------------------
form表单提交设置编码
onsubmit="document.charset='gbk';"
-----------------------------------------------------------------------------
sql去重取最新一条数据:
select A.id, A.Cljg_Mc
  from table A
where A.created_time =
       (select max(created_time) from table b where A.id = B.id);
oracle分页查询:
SELECT * FROM  

SELECT A.*, ROWNUM RN  
FROM (SELECT * FROM TABLE_NAME) A  
WHERE ROWNUM <= 40 

WHERE RN >= 21

-----------------------------------------------------------------------------
json DATA对象转化为url参数String:
调用(解码) :var param = decodeURIComponent(parseParam(obj));;

var parseParam=function(param, key){
    var paramStr="";
    if(param instanceof String||param instanceof Number||param instanceof Boolean){
        paramStr+="&"+key+"="+encodeURIComponent(param);
    }else{
        $.each(param,function(i){
            var k = key==null?i:key+(param instanceof Array?"["+i+"]":"."+i);
            paramStr+='&'+parseParam(this, k);
        });
    }
    return paramStr.substr(1);
};
------------------------------------------------------------------------------
访问端口后边:
server.xml配置URIEncoding="GBK"
catalina.bat
tomcat命名:
找到set _EXECJAVA=start "XXX" %_RUNJAVA%这一行,然后将xxx替换为你喜欢的任意名称,例如localTomcat。
tomcat:指定jdk:
catalina.bat开头添加
set JAVA_HOME=D:\MyJob\JDK\jdk1.7
set JRE_HOME=D:\MyJob\JDK\jdk1.7\jre
或setclasspath.bat头添加
set JAVA_HOME=C:\Java\jdk1.60
set JRE_HOME=C:\Java\jre1.60

<Context path="" docBase="D:\workspaces\workspace\xxxxxx\web" sessionCookieName="tomcat6.4" reloadable="false" crossContext="true"/>


部署多个tomcat主要修改三个端口:
1.HTTP端口,默认8080,如下改为8081
[html] view plain copy
<Connector port="8081" protocol="HTTP/1.1"  
               connectionTimeout="60000"  
               redirectPort="8443" disableUploadTimeout="false"  executor="tomcatThreadPool"  URIEncoding="UTF-8"/> 

2.远程停服务端口,默认8005,如下改为8006
[html] view plain copy
<Server port="8006" shutdown="SHUTDOWN">...... 

3.AJP端口,默认8009,如下改,8010
[html] view plain copy
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" /> 
------------------------------------------------------------------------------
jsp中el取url中值:
1.html中:${param.typeId }
2.js中取值:var a = "${param.typeId }";
-----------------------------------------------------------------------------
更改oracle密码
alter user apps identified by 123456;
3、解锁
SQL> alter user test account unlock;
-----------------------------------------------------------------------------
jsp页面通过EL表达式获取url中参数
alert("${param.typeId }");(js中)
${param.typeId }          (body中)
-----------------------------------------------------------------------------
//oracle授权查询 授权表 (或视图)table 给用户 xxxxxx_dba;
grant select on tableto xxxxxx_dba;
------------------------------------------------------------------------------
ateFormat format 2= new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
------------------------------------------------------------------------------
INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)

----------------------------------------------------------------------------
function validate(){
var userName=trim(document.getElementById("userName").value);
document.getElementById("userName").value=userName;
var passWord=trim(document.getElementById("passWord").value);
if(userName == "")
{
alert("请你输入用户名!\n");
document.getElementById("userName").focus();
return false;
}
if(passWord == "")
{
alert("请你输入密码!\n");
document.getElementById("passWord").focus();
return false;
}

document.getElementById("userName").value = document.getElementById("userName").value.toUpperCase();
if(document.getElementById('saveUsernameCkb').checked) {
addCookie('saveUsername', document.getElementById('userName').value, 1000);
} else {
delCookie('saveUsername');
}
loginForm.submit();
}

//
function addCookie(objName,objValue,objHours){//添加cookie
var str = objName + "=" + escape(objValue);
if(objHours > 0){//为0时不设定过期时间,浏览器关闭时cookie自动消失
var date = new Date();
var ms = objHours*3600*1000;
date.setTime(date.getTime() + ms);
str += "; expires=" + date.toGMTString();
}
document.cookie = str;
}

function getCookie(objName){//获取指定名称的cookie的值
var arrStr = document.cookie.split("; ");
for(var i = 0;i < arrStr.length;i ++){
var temp = arrStr[i].split("=");
if(temp[0] == objName) return unescape(temp[1]);
}
}
function delCookie(name){//为了删除指定名称的cookie,可以将其过期时间设定为一个过去的时间
var date = new Date();
date.setTime(date.getTime() - 10000);
document.cookie = name + "=a; expires=" + date.toGMTString();
}
function keyChange() { 
var Txtstr=document.getElementById("userName"); 
var evt=window.event; 
var nKeyCode=evt.keyCode||evt.which; 
var sInput=Txtstr.value; 
if (nKeyCode>=65 && nKeyCode<=90){
Txtstr.value=sInput.toUpperCase();    
}
}
----------------------------------------------------------------------------
alter table tablemodify AFSJ VARCHAR2(10);
alter table lcjk_dygxb rename column LEIBIE3 to yclburl;
----------------------------------------------------------------------------
poi读取Excel数据设置读取数据类型:
cell.setCellType(cell.CELL_TYPE_STRING);
value = cell.getStringCellValue();

-----------------------------------------------------------------------------
<%@ page import="net.sf.json.JSONArray"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Calendar"%>
时间戳获取TimeInMillis转日期;
JSONObject date = (JSONObject) hm.get(colField[j]);
Calendar c = Calendar.getInstance();
c.setTimeInMillis(Long.valueOf(date.getLong("time")));
String dateString = new SimpleDateFormat("yyyy年MM月dd日").format( c.getTime());

------------------------------------------------------------------------------
针对直接部属到webApps:context.xml中用
<Context sessionCookiePath="/" sessionCookieName="xxxxxx">
部署指定:
<Context path="" docBase="D:\MyJob\Workspaces\xxxxxxnew\web" debug="0" sessionCookieName="tomcat6" reloadable="false" crossContext="true" URIEncoding="GBK"/>

------------------------------------------------------------------------------
//将表单数据转为json
    function form2Json(id) {

        var arr = $("#" + id).serializeArray()
        var jsonStr = "";

        jsonStr += '{';
        for (var i = 0; i < arr.length; i++) {
            jsonStr += '"' + arr[i].name + '":"' + arr[i].value + '",'
        }
        jsonStr = jsonStr.substring(0, (jsonStr.length - 1));
        jsonStr += '}'

        var json = JSON.parse(jsonStr)
        return json
    }

------------------------------------------------------------------------------
oracle查询恢复数据;具体时间根据实际情况;
select  *  from table as of timestamp  to_timestamp ('2017-05-25 15:45:00','yyyy-mm-dd hh24:mi:ss');
闪回到15分钟前
select *  from table as of timestamp (systimestamp - interval '15' minute);
------------------------------------------------------------------------------
easyUI combobox使用
$('#fpclr').combobox({   
    url:'./combobox_data.json',   
    valueField:'id',
    multiple:true,
    separator:',',
    textField:'text',
    onChange:function(){   
    var jbr = $('#fpclr').combobox("getValues");
    var jbrGh = $('#fpclr').combobox("getText");
    $("#jbr").val(jbr);
    $("#jbrGh").val(jbrGh);
        } 
});
------------------------------------------------------------------------------
excel导入oracle
1.将Excel另存为.csv格式
2.新建input.ctl文件(置于D:\),内容为:
load data
infile 'd:\student.csv'
append into table student fields terminated by ','
trailing nullcols(id,name,sex,age)
说明:infile后面参数为欲导入的excel表(已转换成csv格式)路径及名称;append在表后追加;
table后面跟oracle数据库中的表名称; terminated by ','表示字段分隔符;(id,name,sex,age)表示字段名称列表
3.同时按Windows徽标键和R键,打开运行,输入cmd,打开命令提示符,输入命令:
sqlldr userid=system/test@netservicename control=d:\input.ctl
说明:system/test,为oracle数据库表student的所有者及其密码;
@  netservicename为网络服务名;
control是input.ctl文件名称及路径
------------------------------------------------------------------------------
java:对象List转JSONArray
import net.sf.json.JSONArray;
List<Bo> list1 = (List<Bo>)request.getAttribute("list");
JSONArray list = JSONArray.fromObject(list1);
java: json对象数组转List
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
JSONObject jsonObject = JSONObject.fromObject(condition);
JSONArray arr = (JSONArray) jsonObject.get("rules");
List<ConditionBo> list2 = JSONArray.toList(arr, new ConditionBo(), new JsonConfig());

-------------------------------------------------------------------------------
/**
* 获取指定路径下图片的二进制
* @param imgSrc
* @return
*/
public static byte[] imageToBytes(String imgSrc){
byte[] bytes=null;
        FileInputStream fin=null;
try {
if(StringUtils.isNotBlank(imgSrc)){
File folder = new File(imgSrc);
if(folder.exists()){
fin = new FileInputStream(new File(imgSrc));
bytes  = new byte[fin.available()];
fin.read(bytes); 
        fin.close();
}else{
System.out.println("=======================================================图片路径为:"+imgSrc);
}
}else{
System.out.println("==========================================================图片的路径为空!!");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
        return bytes; 

------------------------------------------------------------------------------
    <!--定时任务抽取材料-->
    <insert id="insertWsByTime" parameterType="java.util.Map">
        INSERT INTO JZ_WS_FILEINF DZJZ
          (ID,
           CASE_NO,
           ADDDATETIME,<!--添加时间-->
          )
          SELECT table.NEXTVAL,
          ${ID},
          ADDDATETIME,
          replace('${BASE_URL}'||'?'||'id='||${DOC_ID}||'<![CDATA[&]]>'||'ID='||${ID},' ',''),
         
           FROM  ${TABLE_NAME}
           WHERE  isdel = '0'

    </insert>
------------------------------------------------------------------------------
纯js创建提交表单

function post(url,params){
   var temp = document.createElement("form");
   temp.action = url;
   temp.method = "post";
   temp.style.display="none";
   for(var x in params){
    var opt = document.createElement("input");
    opt.name= x;
    opt.value = params[x];
    temp.appendChild(opt);
   }
  document.bady.appendChild(temp);
  temp.submit();
  return temp;
}
post('dzjzDownLoad.do',{"jzType":jzType,"mlh":mlh,"ID":ID});
---------------------------------------------------------------------------
//计算年龄含天数
var TFSJ = rowData.tjsj
var CSRQ = rowData.Chushengriqi
var  a = TFSJ.split('/');
var  b = CSRQ.split('/');
if(TFSJ!=''){
  if(a[1]>b[1]){
    var c = a[0]-b[0];
    var d = a[0]+'/'+b[1]+'/'+b[2];
    var oldTime= (new Date(TFSJ)).getTime();
    var csrqTime= (new Date(d)).getTime();
    var nlts =(oldTime-csrqTime)/(24*60*60*1000);      
  }else if(a[1]==b[1]&&a[2]>=b[2]){
    var  c = a[0]-b[0];
       
  }else{
      var  c = a[0]-b[0]-1;
      alert(c);
  }
}
return c;
-----------------------------------------------------------------------------
//计算年龄sql
select t.*, y.newdate,
     decode(t.tjsj,'','', (trunc(months_between(t.tjsj,
                           t.chushengriqi+1) / 12) || '岁' || '零' )||
       (trunc(t.tjsj -
             (add_months(t.chushengriqi+1,
                         trunc(months_between(t.tjsj,
                                              t.chushengriqi+1
                                                     ) / 12) * 12))) || '天') ) PZSNL,
                                              decode(y.newdate,'','', (trunc(months_between(y.newdate,
                           t.chushengriqi+1) / 12) || '岁' || '零' )||
       (trunc(y.newdate -
             (add_months(t.chushengriqi+1,
                         trunc(months_between(y.newdate,
                                              t.chushengriqi+1
                                                     ) / 12) * 12))) || '天')) ZXSNL
      
     
  from (select a.*, c.tjsj
          from (select
                       b.chushengriqi,
                       b.ID,
                       b.adddatetime
                  from tableb b
                 order by b.adddatetime desc) a
          left join tablec c
            on c.ID = a.ID) t
  left join tabley y
    on t.ID = y.ID
where 1 = 1
------------------------------------------------------------------------------------
   var grid_width;
var grid_init=false;

function caculate_grid_width_func(){


var tabPanel = $('#documentlist').closest('.tabs-panels');
if(tabPanel.length>0){
grid_width = tabPanel.width();
}else{
grid_width=$('#documentlist').width();
}


}

/**设置百分比*/
function count_width_func(columnWidth){
var result = 128;
var diff = 0;
columnWidth=null==columnWidth||''==columnWidth||'100%'==columnWidth?'128':columnWidth;

if ( $.browser.msie ){
if('9.0'==$.browser.version )
diff=3;
else if('8.0'==$.browser.version )
diff=3;
else
diff=6;
}
else if($.browser.chrome)
diff=5;
else
diff=2;

if(columnWidth.indexOf('%')>0){
columnWidth=columnWidth.replace('%','')*1;
result=grid_width*columnWidth/100;
}
else if(columnWidth.indexOf('px')>0){
columnWidth=columnWidth.replace('px','');
result=columnWidth;
}
else
result=columnWidth;
return Math.ceil(result)-diff;
}

-----------------------------------------------------------------------------------
  <!-- mybatis oracle分页查询 -->
    <select id="getAllMsgByMlh" resultType="java.util.HashMap">
      SELECT *
FROM (SELECT A.*, ROWNUM RU 
          FROM (SELECT  ID,
            PAGENUM
                  FROM table
                   WHERE mlh = '${mlh}'
                 ORDER BY START_PAGE) A
        where ROWNUM <![CDATA[ < ]]> '${end}')
WHERE RU >= '${start}'
    </select>

----------------------------------------------------------------------------------
$(window.top.document.getElementById("nav_frame")).attr("src","");
--------------------------------------------------------------------------------------
//去重
select distinct t.id from table t
--------------------------------------------------------------------------------------
//提示框
$.messager.alert('添加提醒','请至少选择一条数据!','icon-info',function(){});
------------------------------------------------------------------------------------
UPDATE table SET r1='',UPDATE_TIME=TO_DATE('2016-08-24 17:27:38','yyyy/mm/dd hh24:mi:ss')  WHERE  ID = '37'
select table.* from table where 1=1  AND (   (OPERATORTIME>=TO_DATE('2016/08/30 00:00:00','yyyy/mm/dd hh24:mi:ss') AND OPERATORTIME<=TO_DATE('2016/08/30 23:59:59','yyyy/mm/dd hh24:mi:ss')))
-----------------------------------------------------------------------
hibernate主键策略,若为sequence,主键type及实体需为java.lang.Long或java.lang.Integer类型
数据库数据类型可为String;
-----------------------------------------------------------------------
//java生产随机数
<%=Math.round(Math.random()*200000)%><%=System.currentTimeMillis()%>
//js获取随机数
var random =Math.round(Math.random()*100000000);
-----------------------------------------------------------------------
//数组转字符串js
JSON.stringify(fields)
-----------------------------------------------------------------
//java 遍历request参数
Map<String, String[]> formDatas = request.getParameterMap();
        Map<String, Object> params = new HashMap<String, Object>();
        for (String key : formDatas.keySet()) {
            String[] value = formDatas.get(key);

            params.put(key, StringUtils.arrayToString(value));

        }
-------------------------------------------------------------
<SCRIPT language="javascript">
function addDate(dd,dadd){
var a = new Date(dd)
a = a.valueOf()
a = a + dadd * 24 * 60 * 60 * 1000
a = new Date(a)
return a;
}

//抓取现在日期

var now = new Date("2008/03/01");
var years = now.getYear()+1;
var months = now.getMonth()+1;
var days = now.getDate();
var hours = now.getHours();

//抓取前一天日期

NextNow = addDate(months+"/"+days+"/"+years,-1);
years = NextNow.getYear();
months = NextNow.getMonth()+1;
days = NextNow.getDate();

alert("加一年减一天的日期:"+years+"年"+months+"月"+days+"日");

</SCRIPT>

-------------------------------------------------------------
定义和用法
stringObject.indexOf(searchvalue,fromindex);
说明
该方法将从头到尾地检索字符串 stringObject,看它是否含有子串 searchvalue。开始检索的位置在字符串的 fromindex 处或字符串的开头(没有指定 fromindex 时)。如果找到一个 searchvalue,则返回 searchvalue 的第一次出现的位置。stringObject 中的字符位置是从 0 开始的
indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置。
注释:indexOf() 方法对大小写敏感!
注释:如果要检索的字符串值没有出现,则该方法返回 -1。
---------------------------------------------------------
   var url=window.location.href;
    alert(url);
   var values = url.split("/gadkform");
    alert(values[0]);
var valueArray = values.split(',');
---------------------------------------------------------
数字、单词等元素换行css设置
style="word-break:break-all;"
-------------------------------------------------------------
//js获取url
var url=window.location.href;
-------------------------------------------------
//
window.top.location.href="/indexInit.do?ID="+ID;
//本地跳转
window.location.href="/gadkform/jcsrjyzmsSave?id="+id1+"&ID="+ID;
//截取字符串
var Iidd = $("#qsyjsSaveForm_Iidd").val();
  if(Iidd != ''){
    var arr = Iidd.toString().split(",");
var size = arr.length;
for(i=0;i<size;I++){
var value = arr[i];
$("#qsyjsSaveForm_Iidd").val(value);
/**参数:KForm表单标识;参数:子表单标识;参数:按钮标识;参数:其他需要提交的子表单标识数组;参数:其他需要提交的grid的子表单数组;参数:回调函数;参数:自定义提交数据*/
KFormTools.submitForms('qsyjsSave','qsyjsSave_qsyjsSaveForm','btn_confirm',[],[],function(data){
var success = KFormTools.getReturnSuccess(data);
      if(success){
var id = data.dataObject.id;
        }
    });
   }
  }
-------------------------------------------------------------
//去所有空格
1
String.prototype.NoSpace=function(){
  return this.replace(/\s+/g,"");
}
//调用
var aaa="阿斯蒂芬 啊撒打算";
aaa.NoSpace();

2
aaa.replace(/\s+/g,"");
-------------------------------------------------------------
tmp = tmp.replace(/\n/g,'<br/>');
tmp = tmp.replace(/\s/g,'&nbsp;');
--------------------------------------------------------------
/**
* 传参数名,获取地址栏参数值
* @param {Object} paramName
* @return {TypeName}
*/
function getDataByPlace(paramName){
var reg = new RegExp("(^|&)"+paramName+"=([^&]*)(&|$)");
var url =window.location.search.substr(1).match(reg);
if(url == null){
return null;
}
return url[2];
}
----------------------------------------------------------------
//css左右对其
style="text-align:justify;text-justify:inter-ideograph;"
-----------------------------------------------------------------
上一篇: 慎用URLConnection.guessContentTypeFromStream推断文件mime类型 下一篇: 没有下一篇了!
发表评论
用户名: 匿名