转载请注明来源:https://www.cnblogs.com/hookjc/

/*

Create By:jiangcheng_15

Create Date:2012-01-32

*/

function SaveConn()
{
 var ConnParam={
  sum  :5,
  splitxt :',',
  lastconn:''
 };
 
 this.Save=function(conn)
 {
  if(typeof(conn)!='string') return '';
  if(conn=='') return '';
  var strconn='';
  var ishas=false;
  var sconarr=conn.split(ConnParam.splitxt);
  var connarr=ConnParam.lastconn.split(ConnParam.splitxt);
  for(var i=0;i<sconarr.length;++i)
  {
   ishas=false;
   for(var j=0;j<connarr.length;++j)
   {
    if(connarr=='') continue;
    if(sconarr[i]==connarr[j]&&j==0)
    {
     strconn=ConnParam.splitxt+ConnParam.lastconn;
     ishas=true;
     break;
    }
    else if(sconarr[i]==connarr[j]) 
    {
     strconn=ConnParam.splitxt+connarr[j]+strconn;
     ishas=true;
    }
    else strconn+=ConnParam.splitxt+connarr[j];     
   }
   if(!ishas)
    strconn=ConnParam.splitxt+sconarr[i]+strconn;
  }  
  strconn=strconn.substr(ConnParam.splitxt.length);
  connarr=strconn.split(ConnParam.splitxt); 
  strconn='';
  for(var i=0;i<connarr.length;++i)
  {
   strconn+=ConnParam.splitxt+connarr[i];
   if(i==ConnParam.sum-1) break;
  }
  ConnParam.lastconn=strconn.substr(ConnParam.splitxt.length);
  return ConnParam.lastconn;
 }; 
 
 this.GetConn=function(){return ConnParam.lastconn;}; 
 this.SetConn=function(conn){ConnParam.lastconn=conn;};
 this.SetSum=function(sum){ConnParam.sum=sum;};
 this.SetSeporator=function(splitxt){ConnParam.splitxt=splitxt;};
};

来源:python脚本自动迁移

js 保存并排序输入内容的更多相关文章

  1. JS 模仿京东键盘输入内容

    css代码 .search { width: 300px; height: 80px; margin: 0 auto; position: relative; } .con { display: no ...

  2. infopath重复表格无法保存输入内容

    现象: infopath重复表格无法保存文本输入内容,可以保存日期控件输入内容 原因: 在重复表中添加格式类型规则导致无法保存.

  3. js 捕捉回车键触发登录,并验证输入内容

    js 捕捉回车键触发登录,并验证输入内容 有时候我们会遇到 web 页面中捕捉按键,触发一些效果, 比如常见的回车键触发登录,并验证输入内容,下面会介绍,截图: 一.最简单的捕捉回车键:判断按下的是不 ...

  4. 正则表达式控制Input输入内容 ,js正则验证方法大全

    https://blog.csdn.net/xushichang/article/details/4041507 //输入姓名的正则校验 e.currentTarget.value = e.curre ...

  5. js 检测输入内容是否为空(小程序,网站)

    一.输入内容只要有空格就会返回true if(/\s*/.test(data)){ return true }else{ return false } 二.先替换掉空格,更利于赋值或者判断 1.需要判 ...

  6. 防御XSS攻击-encode用户输入内容的重要性

    一.开场先科普下XSS 跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS.恶 ...

  7. 使用iScroll时,input等不能输入内容的解决方法

    做移动平台的应用,使用iscroll使屏幕上下滑动.发现当使用iscroll后,input等不能输入内容了.只要在iscroll.js文件中加入如下代码就ok了. function allowForm ...

  8. 使用iScroll时,input等不能输入内容的解决方法(share)

    最近做移动平台的应用,使用iscroll使屏幕上下滑动.发现当使用iscroll后,input等不能输入内容了.只要在iscroll.js文件中加入如下代码就ok了. function allowFo ...

  9. php中关于js保存文件至本地的问题

    最近在搞一个livezilla的在线客服聊天的东东,客户界面要求添加一个下载聊天记录的功能.于是我就是翻看了下网上的各种关于”js保存文件至本地“的资料,发现只能在IE下通过execCommand实现 ...

随机推荐

  1. AVD Pixel_2_API_30 is already running. lf that is not the case, delete the files at

    AVD Pixel_2_API_30 is already running. lf that is not the case, delete the files at C:\Users\Adminis ...

  2. Java中List与数组互相转换

    1.说明 在Java中,经常遇到需要List与数组互相转换的场景. List转换成数组,可以使用List的toArray()或者toArray(T[] a)方法. 数组转换成List,可以使用Arra ...

  3. 初识MASA Blazor

    MASA Blazor是一个Blazor的UI组件库.就像大家写前端熟知的Bootstrap, Ant Design一样. MASA Blazor官网地址:https://blazor.masasta ...

  4. ':app@debug/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:30.+.

    ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version th ...

  5. 利用static来实现单例模式

    一:之前旧的写法 class Singleton{ private Singleton() {} private static Singleton instance = null; public sy ...

  6. Hive建表和内外部表的使用

    原文链接: https://www.toutiao.com/i6766784274965201415 一.普通建表方式 create table stu_info( id int, name stri ...

  7. UVA 156 Ananagrams (STL multimap & set)

    原题链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&p ...

  8. RDA5807M开发指南 & 开源库函数

    文档标识符:RDA5807M_T-D-P16 作者:DLHC 最后修改日期:2022.1.14 最后修改内容:修改.添加内容 发布状态:已发布 本文链接:https://www.cnblogs.com ...

  9. Java中生成一个唯一值的方式

    现总结几种生成一个唯一值的方式 第一种:采用nanoTime() // 理论上存在重复的可能,可以在后面再加上一个随机字符串 Random r = new Random(); for (int i = ...

  10. 【pwn】学pwn日记——栈学习(持续更新)

    [pwn]学pwn日记--栈学习(持续更新) 前言 从8.2开始系统性学习pwn,在此之前,学习了部分汇编指令以及32位c语言程序的堆栈图及函数调用. 学习视频链接:XMCVE 2020 CTF Pw ...