Advertisement
Advertisement
| 02.22.2008 at 01:41PM PST, ID: 23185997 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: |
<html>
<head>
<title>Table Row Selection</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
var aSelectedRows = new Array();
var oLastRow;
function selectClick(e, oRow ) {
if(e)event=e;
event.returnValue = false;
if(event.ctrlKey ) {
toggleRow( oRow );
}
if(event.shiftKey) {
selectRowsInbetween( oRow );
}
if(!event.ctrlKey && !event.shiftKey){
clearAllRows();
toggleRow( oRow );
}
oLastRow = oRow;
/* Private Methods - selectClick() */
function clearAllRows(){
for(i=0;i<aSelectedRows.length;i++) {
aSelectedRows[i].style.backgroundColor = '';
aSelectedRows[i].cells[0].firstChild.checked = false;
}
aSelectedRows = new Array();
}
function toggleRow( oRow ) {
if ( oRow.style.backgroundColor == 'red' ) {
oRow.style.backgroundColor = '';
for(i=0;i<aSelectedRows.length;i++)
if(aSelectedRows[i]==oRow)
aSelectedRows.splice(i,1);
} else {
oRow.style.backgroundColor = 'red';
aSelectedRows[aSelectedRows.length]=oRow;
oRow.cells[0].firstChild.checked = true;
}
}
function selectRowsInbetween( oRow ) {
//if(!event.ctrlKey)
// clearAllRows();
var aRows = oRow.parentNode.parentNode.rows;
from = Math.min(oLastRow.rowIndex, oRow.rowIndex);
to = Math.max(oRow.rowIndex, oLastRow.rowIndex);
for (var i=from; i<=to; i++ ) {
if ((aRows[i].style.backgroundColor != 'red') && (i > 0)) {
aRows[i].style.backgroundColor = 'red';
aRows[i].cells[0].firstChild.checked = true;
aSelectedRows.push(aRows[i]);
}
}
}
/* Private Methods - selectClick() */
}
function setMouse(tabID){
theTab = document.getElementById(tabID);
oLastRow = theTab.rows[0];
theTab.style.cursor = 'default';
theTab.onselectstart = function(){return false};
for(i=0;i<theTab.rows.length;i++)
theTab.rows[i].onmousedown=function(event){selectClick(event, this)};
}
function getSelect(theForm){
theSel = new Array();
for(r in aSelectedRows)
theSel[theSel.length]=aSelectedRows[r].rowIndex;
theSel.sort();
selVal = '';
for(i=0;i<theSel.length;i++)
selVal+=' '+theSel[i];
theForm.SelectedRows.value=selVal.substr(1);
}
function upRow() {
var firstDataRow = 1;
var canUpRow = true;
for (var i = 0; i < aSelectedRows.length; i++) {
if (aSelectedRows[i].rowIndex == firstDataRow) {
canUpRow = false;
}
}
if (canUpRow) {
var rowUpData = null;
var aRow = null;
var aRowDest = null;
for (var i = 0; i < aSelectedRows.length; i++) {
aRow = aSelectedRows[i];
rowUpData = new Array();
var aRows = aRow.parentNode.parentNode.rows;
aRowDest = aRows[aRow.rowIndex-1];
for (var iCell = 0; iCell < aRow.cells.length; iCell++) {
rowUpData[iCell] = aRow.cells[iCell].innerHTML;
aRow.cells[iCell].innerHTML = aRowDest.cells[iCell].innerHTML;
aRowDest.cells[iCell].innerHTML = rowUpData[iCell];
aRowDest.style.backgroundColor = 'red';
aRow.style.backgroundColor = '';
aSelectedRows[i] = aRowDest;
aRowDest.cells[0].firstChild.checked = true;
}
}
} else {
alert("You cant up the first row!");
}
}
function downRow() {
var lastDataRow = 6;
var canDownRow = true;
for (var i = 0; i < aSelectedRows.length; i++) {
if (aSelectedRows[i].rowIndex == lastDataRow) {
canDownRow = false;
}
}
if (canDownRow) {
var rowUpData = null;
var aRow = null;
var aRowDest = null;
for (var i = aSelectedRows.length-1; i >= 0; i--) {
aRow = aSelectedRows[i];
rowUpData = new Array();
var aRows = aRow.parentNode.parentNode.rows;
aRowDest = aRows[aRow.rowIndex+1];
for (var iCell = 0; iCell < aRow.cells.length; iCell++) {
rowUpData[iCell] = aRow.cells[iCell].innerHTML;
aRow.cells[iCell].innerHTML = aRowDest.cells[iCell].innerHTML;
aRowDest.cells[iCell].innerHTML = rowUpData[iCell];
aRowDest.style.backgroundColor = 'red';
aRow.style.backgroundColor = '';
aSelectedRows[i] = aRowDest;
aRowDest.cells[0].firstChild.checked = true;
}
}
} else {
alert("You cant down the last row!");
}
}
//-->
</SCRIPT>
</head>
<body onLoad="setMouse('someTab')">
<form onSubmit="getSelect(this)">
<input type="hidden" name="SelectedRows">
<table class="selectRows" id="someTab" align="center" width="200" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>h1</td>
<td>h2</td>
<td>h3</td>
</tr>
<tr>
<td>0</td>
<td>Quincy</td>
<td>Acklen</td>
</tr>
<tr>
<td>1</td>
<td>Neil</td>
<td>Green</td>
</tr>
<tr>
<td>2</td>
<td>Holly</td>
<td>Quarzo</td>
</tr>
<tr>
<td>3</td>
<td>Mike</td>
<td>Senzon</td>
</tr>
<tr>
<td>2</td>
<td>Holly</td>
<td>Quarzo</td>
</tr>
<tr>
<td>3</td>
<td>Mike</td>
<td>Senzon</td>
</tr>
</table>
<center>
<input type="button" value="up" onclick="upRow()">
<input type="button" value="down" onclick="downRow()">
<input type=submit value="submit"></center>
</form>
</body>
</html>
|