本文目錄一覽:
- 1、求個動態js表格,有增刪改的,3Q~
- 2、西子緒文集百度雲網盤
- 3、請問如何用PSCC做出動態水波紋
- 4、我的博客要怎麼設計才能吸引更多的遊客http://ccjfly.blog.163.com/,請先看看我的博客,
- 5、求助C語言,打印二維數組出現問題,程序是兩個矩陣相乘,cc是我要輸出的數組
求個動態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(“%lf\t”,*(*a + n*i + j)); //這裡的a沒必要進行強制類型轉換
//printf(“%lf\t”, *((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
請按任意鍵繼續. . .
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/244524.html