首页 > 编程知识 正文

ccjsj886空间动态的简单介绍

时间:2023-12-27 22:27:29 阅读:326157 作者:OQPH

本文目录一览:

求个动态js表格,有增删改的,3Q~

htmlheadmeta http-equiv="Content-Type" content="text/html; charset=gb2312"style type="text/css".divClass{height:250px;width:100%;overflow:auto;}

td{height:22px;border-bottom:1px solid black;border-right:1px solid black;cursor:default;}

th{height:20px;font-size:12px;font-weight:normal;border-bottom:2px solid black;border-right:1px solid black;background-color:#999999}

table{border-top:1px solid black;border-left:1px solid black;font-size:13px;}

input{border:1px solid black;}

.TrOdd{font-family: "宋体";font-size: 12px;background-color: #FFFFFF;}

.TrEven{font-family: "宋体";font-size: 12px;background-color: #CCCCCC;}

/stylescript language="javascript"

var mainTab = null;

var currentRowIndex = null;

var currentCell = null;

var orgContent = "";

//标记是否能编辑

var editbleFlag = true;

var showColume = false;

//选中行默认颜色var currentBgc = "cornflowerblue";

//选中行字体颜色

var currentFontColor = "black";

//用来保存下拉菜单中的option项

var optionText = "";

//图片列号

var imagePos = 0;

//保存每一列的编辑类型

var colStyle = new Array();

//保存下拉框中的text和value

var sText = new Array();

var sValue = new Array();

//增加是各个单元格的数据

var cellData = new Array();

function PowerTableEdit(tableId)

{ //当前选中行

currentRowIndex = null;

//当前编辑cell

currentCell = null;

mainTab = document.all(tableId);

//获取已定义的颜色

readDef(mainTab);

mainTab.onclick = clickIt;

//mainTab.ondblclick = dblclickIt;

//设置select下拉框的数据

this.setCol = setColStyle;

this.setEditable = setEditable;

this.setCellData = setCellData;

this.getColData = getColData;

this.getRowData = getRowData;

//原始表格,可以支持reset

orgContent = mainTab.outerHTML;

//初始化增加表格的数据

for(var i=0; i mainTab.rows[0].cells.length; i++)

cellData[i] = " ";

setEvenOddColor(mainTab);}

//为select的onchange事件指定动作

function selectChangeAction()

{var cellNum = currentCell.cellIndex;

var valueOfSel = document.all.powerTableSel.value;

//给单元格的data赋值

event.srcElement.parentNode.data = event.srcElement.value;

//动作代理

selectProxy(cellNum,valueOfSel);}

function selectProxy(cellNum, valueOfSel){}

//获取指定列的所有数据,以数组形式返回,如果是文本编辑方式,就返回文本内容,

//如果是下拉框编辑方式,则返回其value值,即td中的data值

//colIndex为列号,isImg为是否为图片

function getColData(colIndex,isImg)

{ if(colIndex == "")

return null;

var colNum = colIndex == null ? 0 : colIndex;

//如果为指定此参数,则默认为false,即不是图片格式数据

var isImgCol = isImg == null ? false : isImg;

var arrCelData = new Array();

if(/D/g.test(colNum)

|| colNum = mainTab.rows[0].cells.length

|| colNum 0)

return null;

if(isImgCol)

{ for(var i=1; imainTab.rows.length; i++)

{if(mainTab.rows[i].cells[0].children[0] mainTab.rows[i].cells[0].children[0].tagName.toLowerCase() == "img")

arrCelData[i-1] = mainTab.rows[i].cells[0].data;

else arrCelData[i-1] = null; } }

else { if(colStyle[parseInt(colNum)] == "txt")

{ for(var i=1; imainTab.rows.length; i++)

{ if(mainTab.rows[i].cells[colNum].children.length0)

arrCelData[i-1] = mainTab.rows[i].cells[colNum].children[0].value;

else arrCelData[i-1] = mainTab.rows[i].cells[colNum].innerText; } }

else if(colStyle[parseInt(colNum)] == "sel")

{for(var i=1; imainTab.rows.length; i++)

arrCelData[i-1] = mainTab.rows[i].cells[colNum].data; }

else { for(var i=1; imainTab.rows.length; i++)

arrCelData[i-1] = mainTab.rows[i].cells[colNum].innerText; }}

return arrCelData;}

//获取指定行的所有数据,以数组形式返回,如果是文本编辑方式,就返回文本内容,

//如果是下拉框编辑方式,则返回其value值,即td中的data值

//rowIndex为列号,isImg为是否为图片,如果是图片,则返回图片的id

function getRowData(rowIndex)

{ var arrRowData = new Array();

var rowNum = rowIndex == null ? 1 : rowIndex;

if(/D/g.test(rowNum)

|| rowNum = mainTab.rows.length

|| rowNum = 0)

return null;

for(var i=0; imainTab.rows[rowIndex].cells.length; i++)

{ with(mainTab.rows[rowIndex].cells[i])

{ if(children.length 0) {

if(children[0].tagName.toLowerCase() == "img")

arrRowData[i] = data;

else if(children[0].tagName.toLowerCase() == "select")

arrRowData[i] = data;

else if(children[0].tagName.toLowerCase() == "input")

arrRowData[i] = children[0].value;

else arrRowData[i] = innerText;}

else { if(colStyle[i] == "sel")

arrRowData[i] = data;

else arrRowData[i] = innerText; } } }

return arrRowData;}

//如果是input或textarea,则允许选中里面的文字

document.onselectstart = function()

{var oObj = event.srcElement;

if(oObj.tagName.toLowerCase() != "input"

oObj.tagName.toLowerCase()!= "textarea")

return false; }

function setColStyle(colNum,colSty,sTxt,sVal)

{ colStyle[parseInt(colNum)] = colSty;

sText[parseInt(colNum)] = sTxt == null ? "" : sTxt;

sValue[parseInt(colNum)] = sVal == null ? "" : sVal;}

//设置是否需要编辑的标记,如果设为true,则表格能编辑,反之不能,默认为可以编辑

function setEditable(editFlag)

{ if(editFlag == null)

editbleFlag == true;

else editbleFlag = editFlag;}

//设置增加时各个单元格的数据

function setCellData(arrData)

{ //如果没有设置数据,则插入各个单元格所在的列数

if(arrData == null) {

for(var i=0; imainTab.rows[0].cells.length; i++)

cellData[i] = i; }

else { if(arrData.length = arrData.length)

{ for(var i=0; imainTab.rows[0].cells.length; i++)

cellData[i] = arrData[i];}

//数据不足,补以列号

if(arrData.length mainTab.rows[0].cells.length)

{for(var i=0; iarrData.length; i++)

cellData[i] = arrData[i];

for(var i= arrData.length; imainTab.rows[0].cells.length; i++)

cellData[i] = i; }}}

function clearColor()

{ objTable=mainTab;

if (currentCell != null)

if (currentCell.children.length0) {

if(currentCell.children[0].tagName.toLowerCase() == "input")

currentCell.innerText=currentCell.children[0].value;

else if(currentCell.children[0].tagName.toLowerCase() == "select")

currentCell.innerHTML=currentCell.children[0].options[currentCell.children[0].selectedIndex].text;}

ClearColor(objTable,currentRowIndex,currentCell);}

function document.onclick()

{ clearColor();

currentRowIndex = null;

currentCell = null;}

function readDef(objTable)

{ReadOrgColor(objTable);}

function clickIt()

{ event.cancelBubble=true;

var currentObject = event.srcElement;

var i = 0 ,j = 0;

//原编辑项变为表格

if(currentCell!=null currentRowIndex!=0

currentObject.type!="select-one"

currentObject.type!="text")

if (currentCell.children.length0 ){

if(currentCell.children[0].tagName.toLowerCase() != "img"

currentCell.children[0].tagName.toLowerCase() != "a")

{ if(currentCell.children[0].tagName.toLowerCase() == "input")

currentCell.innerText=currentCell.children[0].value;

else if(currentCell.children[0].tagName.toLowerCase() == "select")

currentCell.innerHTML=currentCell.children[0].options[currentCell.children[0].selectedIndex].text; } }

if(currentObject.tagName.toLowerCase() != "table"

currentObject.tagName.toLowerCase() != "tbody"

currentObject.tagName.toLowerCase() != "tr")

{var currentTd = getElement(currentObject,"td");

if(currentTd==null) return;

//modified 2004.04.09 更改点击图标,链接可以选择单行

if (currentTd.children.length=0

|| currentTd.children[0].tagName.toLowerCase() == "a"

|| currentTd.children[0].tagName.toLowerCase() == "img")

//end modified 2004.04.09 更改点击图标,链接可以选择单行

{ var currentTr = currentTd.parentElement;

var objTable = getElement(currentTd,"table");

var i = 0;

clearColor();

currentRowIndex = currentTr.rowIndex;

//设置选中的行

if(currentRowIndex!=0)

{ for(i=0;icurrentTr.cells.length;i++)

{with(currentTr.cells[i])

{style.backgroundColor=currentBgc;

style.color=currentFontColor;

}}}}

//根据标记设置是否可编辑

if(editbleFlag) {

currentCell= currentTd;

if(currentCell.children.length!=1 currentCell.parentNode.rowIndex != 0)

{var cellN = currentCell.cellIndex;

if(colStyle[parseInt(cellN)] == 'txt')

editCell(mainTab,currentCell,'txt',true);

else if(colStyle[parseInt(cellN)] == 'sel')

editCell(mainTab,currentCell,'sel',true,sText[parseInt(cellN)],sValue[parseInt(cellN)]);

if(currentCell.children.length 0)

{ if(currentCell.children[0].type == "select-one")

currentCell.children[0].focus();

else currentCell.children[0].select();}}}}

selectRowProxy(currentRowIndex);}

//增加点击一行时的代理动作,参数是选中当前行号function selectRowProxy(currentRowIndex){}

//表格指定位置变为可编辑//目前支持文本和下拉框

function editCell(oTable,oCell,editType,bEditable,sText,sValue)

{ if (bEditable)

{ switch(editType)

{ case 'txt':

if(sText == null)

sText = true;

oCell.innerHTML = "input id=dyText type=text size=10 onKeyDown = judgeKeyToDo() value="+ oCell.innerText.replaceHTML() + "";

break;

case 'sel':

var preValue = oCell.data;//获取当前表格的内容,在下拉框中选中

for(var i=0; isValue.length; i++)

{ //如果是原有表格的内容,则默认选中

if(sValue[i] == preValue)

optionText += "option value='"+sValue[i]+"' selected"+sText[i];

else optionText += "option value='"+sValue[i]+"'"+sText[i];

}

oCell.innerHTML="select id=powerTableSel onKeyDown = judgeKeyToDo()"+optionText+"/select";

//为select的onchange指定事件

oCell.children[0].onchange = selectChangeAction;

//清空缓冲区

optionText = "";

break; }

}}

//向上移动指定表格的行

function Move_up(objTable)

{ event.cancelBubble=true;

if(currentRowIndex == null)

return;

if(currentRowIndex = 1)

return;

else{ MoveUp(objTable,currentRowIndex);

//当前选择也上移

--currentRowIndex; }

setEvenOddColor(mainTab);}

function Move_down(objTable)

{event.cancelBubble=true;

if(currentRowIndex == null)

return;

if(currentRowIndex == mainTab.rows.length-1)

return;

else { MoveDown(objTable,currentRowIndex);

//当前选择也下移

++currentRowIndex;}

setEvenOddColor(mainTab);}

function add_row(objTable)

{ event.cancelBubble=true;

clearColor();

var cellNow = cellData;

//如果没选中行,则在表格的最下方插入

var pos = currentRowIndex==null?objTable.rows.length:(currentRowIndex+1);

addRow(objTable,pos,cellNow);

currentCell=null;

readDef(objTable);

setEvenOddColor(mainTab);

//清除设置的数据

for(var i=0; i mainTab.rows[0].cells.length; i++)

cellData[i] = " ";}

//删除行,并处理当前选择项为不选择

function del_row(objTable)

{ if(currentRowIndex == null)

return;

if(confirm("确实要删除第"+currentRowIndex+"行吗?"))

{delRow(objTable,currentRowIndex);

currentRowIndex=null;

currentCell=null;

clearColor();

setEvenOddColor(mainTab); }}

function res_tab(objTable)

{ objTable.outerHTML=orgContent;

PowerTableEdit(objTable.id);}

//在表格中指定位置,插入元素

function addRow(oTable,rowIndex2Add,c)

{ if (rowIndex2Add0 || rowIndex2AddoTable.rows.length)

return;

var currentCell;

var newRow=oTable.insertRow(rowIndex2Add);

for (var i=0;ic.length;i++)

{ //modified by liu_xc 2004.6.28

//增加一条数据时,如果时select形式的编辑方式,则搜索sValue和sText

//找到与输入值相符的value赋给td的data

if(colStyle[i] == "sel")

{ //如果没有设置数据而直接添加,会在编辑方式为

//select的td中添加选择框数据的第一项

if(c[i] == " " || c[i] == "")

c[i] = sText[i][0];

currentCell=newRow.insertCell(i);

currentCell.innerHTML= c[i];

for(var j=0; jsText[i].length; j++)

{if(c[i] == sText[i][j])

{currentCell.data= sValue[i][j];}

}}

else{ currentCell=newRow.insertCell(i);

currentCell.innerHTML= c[i];}

//modified by liu_xc 2004.6.28

//增加一条数据时,如果时select形式的编辑方式,则搜索sValue和sText

//找到与输入值相符的value赋给td的data }}

//删除指定行

function delRow(oTable,nRowIndex2Del)

{ //不删除标题行;指定行不在表格中也不执行删除;

if (oTable.rows.length==1

||nRowIndex2Del==null

||nRowIndex2Del==0

|| nRowIndex2Del=oTable.rows.length)

return;

else oTable.deleteRow(nRowIndex2Del);}

//获取指定tag的元素 [逐级查找]

function getElement(oElement,sTag)

{ sTag = sTag.toLowerCase();

if(oElement.tagName.toLowerCase()==sTag)

return oElement;

while(oElement=oElement.offsetParent)

{if(oElement.tagName.toLowerCase()==sTag)

return oElement; }

return(null);}

function ClearColor(oTable,nCurRowIndex,oCurCell)

{ //清除选中行表现

if(nCurRowIndex!=null nCurRowIndex != -1)

{for(i=0;ioTable.rows[nCurRowIndex].cells.length;i++)

{ with(oTable.rows[nCurRowIndex].cells[i])

{ style.backgroundColor=oBgc;

style.color=oFc;

} } }

//清除可编辑表格

if(oCurCell!=null)

{ if (oCurCell.children.length0 )

{ if(oCurCell.children[0].tagName.toLowerCase() != "img"

oCurCell.children[0].tagName.toLowerCase() != "a")

{ if(oCurCell.children[0].tagName.toLowerCase() == "input")

oCurCell.innerHTML=oCurCell.children[0].value.replaceHTML();

else if(oCurCell.children[0].tagName.toLowerCase() == "select")

oCurCell.innerHTML=oCurCell.children[0].options[oCurCell.children[0].selectedIndex].text;

}} }}

//读取表格现有颜色

function ReadOrgColor(oTable)

{ for(var i=0;ioTable.rows.length;i++)

{ for(var j=0;joTable.rows[i].cells.length;j++)

{ with(oTable.rows[i])

{ cells[j].oBgc = "";

cells[j].oFc = ""; }}}}

function setEvenOddColor(mainTab)

{ //增加奇偶行的css控制 奇行:tdOdd,偶行:tdEven

for(var i=1; imainTab.rows.length; i++)

{ if(i%2 == 0)

mainTab.rows[i].className = "TrEven";

else mainTab.rows[i].className = "TrOdd"; }

}

//根据在编辑框按键的不同而采取不同的动作

function judgeKeyToDo()

{//按键是tab

if(event.keyCode == 9){

var cellN;

if(currentCell.cellIndex == mainTab.rows[currentRowIndex].cells.length-1)

cellN = -1;

else cellN = currentCell.cellIndex;

var nextCell = mainTab.rows[currentRowIndex].cells[cellN+1];

//如果下一个表格未指定编辑方式,跳过

while(colStyle[parseInt(cellN+1)] == null)

{cellN = cellN + 1;

nextCell = mainTab.rows[currentRowIndex].cells[cellN+1];}

//如果编辑方式为txt

if(colStyle[parseInt(cellN+1)] == 'txt')

{if(currentCell.children.length0)

{if(currentCell.children[0].tagName.toLowerCase() == "input")

currentCell.innerHTML=currentCell.children[0].value.replaceHTML();

else if(currentCell.children[0].tagName.toLowerCase() == "select")

currentCell.innerHTML=currentCell.children[0].options[currentCell.children[0].selectedIndex].text;}

editCell(mainTab,nextCell,'txt',true);

} //如果编辑方式为select

else if(colStyle[parseInt(cellN+1)] == 'sel')

{ if(currentCell.children.length0)

{ if(currentCell.children[0].tagName.toLowerCase() == "input")

currentCell.innerHTML=currentCell.children[0].value.replaceHTML();

else if(currentCell.children[0].tagName.toLowerCase() == "select")

currentCell.innerHTML=currentCell.children[0].options[currentCell.children[0].selectedIndex].text; }

editCell(mainTab,nextCell,'sel',true,sText[parseInt(cellN+1)],sValue[parseInt(cellN+1)]); }

//设置当前表格为下一个单元格

currentCell = nextCell;

if(currentCell.children.length 0)

{ if(currentCell.children[0].type == "select-one")

setTimeout('currentCell.children[0].focus()',10);

else

setTimeout('currentCell.children[0].select()',10);}}

//如果按键是enter

if(event.keyCode == 13)

{if(currentCell.children[0].tagName.toLowerCase() == "input")

currentCell.innerHTML=currentCell.children[0].value.replaceHTML();

else if(currentCell.children[0].tagName.toLowerCase() =="select")

currentCell.innerHTML=currentCell.children[0].options[currentCell.children[0].selectedIndex].text;}}

String.prototype.replaceHTML = function()

{ var result = this;

result = result.replace(//g,"");

result = result.replace(//g,"");

result = result.replace(//g,"");

result = result.replace(/s/g," ");

if(result == "")

result = " ";

return result;}

/script

script language="javascript"

function initTable()

{ pt = new PowerTableEdit("table1");

var arrText = new Array();

arrText[0] = "数据一";

arrText[1] = "数据二";

arrText[2] = "数据三";

arrText[3] = "数据四";

var arrValue = new Array();

arrValue[0] = "1";

arrValue[1] = "2";

arrValue[2] = "3";

arrValue[3] = "4";

pt.setCol(2,'txt');

pt.setCol(3,'sel',arrText,arrValue);

pt.setCol(4,'txt');

pt.setCol(5,'txt');

pt.setCol(6,'txt');

pt.setCol(7,'txt');}

function add()

{ var arrDa = new Array();

arrDa[0] = " ";

arrDa[1] = "九";

arrDa[2] = "Tomcat";

arrDa[3] = "数据四";

arrDa[4] = "Ellise";

arrDa[5] = "aaaa";

arrDa[6] = "2.112.521";

arrDa[7] = "美国";

pt.setCellData(arrDa);

add_row(mainTab);}

/script

/head

/html

西子绪文集百度云网盘

《西子绪文集》百度网盘txt 最新全集下载

链接:

提取码: dmdk   

西子绪,晋江文学城-网络小说作家。

代表作品《死亡万花筒》、《我五行缺你》、《幻想农场》、《骷髅幻戏图》

请问如何用PSCC做出动态水波纹

首先,在PS中打开一张图片素材。

然后,用椭圆选框工具,在水面上选择一个范围。

再将选择区羽化10个像素

用快捷键ctrl+j复制这个选择区,并按住ctrl键,点一下图层缩略图,载入选择区。

执行,滤镜,扭曲,水波

调节到合适的效果,并预览,合适后确定。

我的博客要怎么设计才能吸引更多的游客http://ccjfly.blog.163.com/,请先看看我的博客,

多写原创精彩博文,甚至可以像狗仔队那样来个“独家暴料”;

将博客装饰得漂亮一点,多加博友,网易还可加入博客圈,增加互访,多留言;

还有一点很重要,就是将博文网址推荐至各大搜索引擎收录,别人就可以在搜索引擎中搜到你的相关文章了。

我之前用过华宇网页随机自动刷新器,是一种自动刷流量的软件,很好用,你可以在狗狗软件搜索中下载。

求助C语言,打印二维数组出现问题,程序是两个矩阵相乘,cc是我要输出的数组

# includestdio.h

# includemath.h

# include malloc.h

void printMatrix(double **a,int m,int n)

{

int i, j;

for (i = 0; i  m; i++)

{

for (j = 0; j  n; j++)

{

printf("%lft",*(*a + n*i + j)); //这里的a没必要进行强制类型转换

//printf("%lft", *((double *)a + n*i + j));

}

printf("n");

}

}

double **matMultiply(double **a, double **b, int m, int n, int p)

{

int i = 0, j = 1, k = 0;

double aij, bjk,cik,**c;

c = (double **)malloc(m * sizeof(double*));

for (i = 0; im; i++)

{

c[i] = (double *)malloc(p * sizeof(double));

for (k = 0; k  p; k++)

{

cik = 0;

for (j = 0; j  n; j++)

{

aij = *((double *)a + n*i + j);

bjk = *((double *)b + p*j + k);

cik = cik + aij * bjk;

}

c[i][k] = cik;

}

}

return c;

}

void main()

{

double a[2][2] = { { 1, 1 }, { 2, 1 } }, b[2][2] = { { 1, 3 }, { 3, 1 } }, c[2][2] = { { 0, 0 }, { 0, 0 } };

double **cc;

int m = 2, n = 2, p = 2;

int i = 0, j = 1, k = 0;

cc = matMultiply(a, b, m, n, p);

printMatrix(cc, m, p);

//释放动态内存空间

for(i=0;ip;i++)

free(cc[i]);

free(cc);

system("pause");

}

//运行结果

F:c_worka.exe

4.000000        4.000000

0.000000        5.000000

请按任意键继续. . .

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。