Ir para conteúdo
Fórum Script Brasil

olimpia

Membros
  • Total de itens

    354
  • Registro em

  • Última visita

Tudo que olimpia postou

  1. olimpia

    Css

    como ficaria o arquivo css?
  2. Tenho varias paginas, onde todas tem botões que fazem a mesma coisa, gostaria de definir uma classe para cada um, mas de uma forma automatica Teria como referenciar um botão a uma classe atraves do seu ID? Tipo btnNovo seria uma class, btnEditar outra class. Mas sem que seja preciso ficar definindo em cada botão.
  3. Valeu...Deu certo, usei este this.style.color = '#AAAAAA';
  4. Ok, valeu... Qual propriedade devo usar para mudar a cor da fonte da TR?
  5. Crystian você tem razão, tirando innerHTML ficou bem mais rapido Mas teria outra forma de fazer o que o innerHTML esta fazendo? Como poderia inserir uma figura na coluna [0] quando o mouse passar pela TR?
  6. Preciso mudar a cor da TR quando o mouse passa pela mesma Estou fazendo o seguinte. function LinhaOver(linha) { linha.cells[0].innerHTML = "<img src='seta.gif' name='imagem'>"; linha.style.backgroundColor="#D7D8B8"; } function LinhaOut(linha) { linha.cells[0].innerHTML = ""; linha.style.backgroundColor="white"; } Na TR <tr onmouseout="LinhaOut(this)" onmouseover="LinhaOver(this)"> Quando tem umas 20 linhas na tabela, fica até que bom, mas quando coloco mas de 100, fica muito lento. Tem como melhorar estea script?
  7. Ok, eu coloquei a mesma pergunta no outro post "Mozilla", mas se quiser responda so aqui mesmo
  8. Preciso desabilitar a seleção de texto. Onselectstart só funciona no IE, usando o onselect não deu certo. Como devo fazer para funcionar no IE e no Mozilla?
  9. Não estou usando mais o insertBefore
  10. Crystian tambem estou precisando de desbilitar a seleção de texto Usando onselect que você mencionou não deu certo, tanto no IE como o no Mozilla Fiz assim <body onselect="return false"> Teria outra forma de desabilitar a seleção de texto ou eu estou fazendo errado?
  11. Valeu Crystian, vou testar o que você me passou Agora sobre o insertBefore, é que preciso cria r um Div na pagina, mas resolvi de outra forma. Eu defini em html o div e deixo o mesmo oculto, quando preciso mostrar o mesmo eu deixo visivel
  12. Estou com alguns problemas no script que passei acima Como faço para substituir este codigo e.srcElement No IE ele retorna o Object onde o mouse foi clicado, tem como fazer isto funcionar no Mozilla? --------------------------------------------- No IE estou usando este codigo abaixo para mudar o cursor de um objeto, mas no Mozilla não funciona. Como devo fazer? objeto.style.cursor = "hand"; ----------------------------- Este insertBefore inserir um objeto na tela, como faço isso no Mozilla?
  13. Valeu Crystian Vou ver o que posso fazer aqui, o arquivo dragdrop.htc contem script em java script para fazer dradrop entre as colunas de uma tabela O Codigo html é este abaixo <table cellspacing="0" rules="all" HitColor="cornflowerblue" HasTopMostPager="false" border="1" id="grid1" style="font-family:verdana;font-size:8pt;border-collapse:collapse;behavior: url(dragdrop.htc);"> <thead> <tr style="background-color:Gainsboro;font-weight:bold;"> <td>*</td> <td>CODIGO</td> <td>NOME</td> <td>CONTAT</td> <td>TELFO1</td> <td>TELFO2</td> <td>CELULA</td> <td>EMAIL</td> </tr> </thead> <tbody> <tr> <td></td> <td>11851</td> <td>Leandro</td> <td>teste</td> <td>111</td> <td>1111</td> <td>1111</td> <td>e-mail@e-mail.com</td> </tr> <tr> <td></td> <td>11851</td> <td>Leandro</td> <td>teste</td> <td>111</td> <td>1111</td> <td>1111</td> <td>e-mail@e-mail.com</td> </tr> </tbody> </table> o codigo do arquivo dragdrop.htc segue abaixo <public:property name='dragColor' /> <public:property name='hitColor' /> <public:property name='HasTopMostPager' /> <public:attach event=oncontentready onevent="init();" /> <script> var tbody, headRow; var bDragMode = false; var objDragItem; var arrHitTest = new Array(); var iArrayHit = false; var ColumnCount = null; var mustRefresh = false; // // Init function.. Fills out variables with data // loaded with oncontentready. // function init() { var i; if (dragColor == null) dragColor = "silver"; if (hitColor == null) hitColor = "lightblue"; // get TBODY - take the first TBODY for the table tbody = element.tBodies(0); if (!tbody) return; // get THEAD - take the unique THEAD for the table var click = element.tHead; if (!click) return; // Determine the row to use (read from HasPager) if (HasTopMostPager == "true") headRow = click.children[1]; else headRow = click.children[0]; if (headRow.tagName != "TR") return; headRow.runtimeStyle.cursor = "hand"; //"move"; ColumnCount = headRow.children.length; for(i=0; i < ColumnCount; i++) { arrHitTest[i] = new Array(); } var cx=0; var cy=0; var c; defaultTitleColor = headRow.children[0].currentStyle.backgroundColor; for (i=0; i<ColumnCount; i++) { var clickCell = headRow.children[i]; clickCell.selectIndex = i; c = clickCell.offsetParent; if (cx == 0 && cy == 0) { while (c.offsetParent != null) { cy += c.offsetTop; cx += c.offsetLeft; c = c.offsetParent; } } arrHitTest[i][0] = cx + clickCell.offsetLeft; arrHitTest[i][1] = cy + clickCell.offsetTop; arrHitTest[i][2] = clickCell; arrHitTest[i][3] = cx + clickCell.offsetLeft + clickCell.clientWidth; clickCell.attachEvent("onmousedown",onMouseDown); } element.document.attachEvent("onmousemove",onMouseMove); element.document.attachEvent("onmouseup",onMouseUp); /////// if (arrHitTest[0][0] == arrHitTest[0][3]) mustRefresh = true; } function InitHeader() { var cx=0; var cy=0; var c; for (i=0; i<ColumnCount; i++) { var clickCell = headRow.children[i]; clickCell.selectIndex = i; c = clickCell.offsetParent; if(cx == 0 && cy == 0 ) { while (c.offsetParent != null) { cy += c.offsetTop; cx += c.offsetLeft; c = c.offsetParent; } } arrHitTest[i][0] = cx + clickCell.offsetLeft; arrHitTest[i][1] = cy + clickCell.offsetTop; arrHitTest[i][2] = clickCell; arrHitTest[i][3] = cx + clickCell.offsetLeft + clickCell.clientWidth; } } //Muda a cor da coluna do cabeçalho function ChangeHeader(iChange) { for(var y = 0; y < arrHitTest.length; y++) { if (arrHitTest[y][2].currentStyle.backgroundColor == hitColor) arrHitTest[y][2].style.backgroundColor = defaultTitleColor; } if(iChange < "1") return; //if(iChange == "-1") return; arrHitTest[iChange][2].style.backgroundColor = hitColor; } function onMouseUp(e) { if(!bDragMode) return; bDragMode = false; var iSelected = objDragItem.selectIndex; objDragItem.removeNode(true); objDragItem = null; ChangeHeader(-1); //Coluna 0 if( (iArrayHit - 1) < 1 || iSelected < 1) return; // default faliure // iSelected is the 0-based index of the column being moved // (iArrayHit-1) is the 0-based index of the column being replaced CopyRow(iSelected, (iArrayHit - 1) ); // Reset our variables iSelected = 0; iArrayHit = -1; } function onMouseDown(e) { // If the grid is contained in an invisible panel (other DHTML stuff) // the initialization step must be repeated to take real values if( mustRefresh) { InitHeader(); mustRefresh = false; } bDragMode = true; var src = e.srcElement; var c = e.srcElement; while (src.tagName != "TD") src = src.parentElement; // Create our header on the fly objDragItem = document.createElement("DIV"); objDragItem.innerHTML = src.innerHTML; objDragItem.style.height = "20px"; //src.offsetParent.clientHeight; objDragItem.style.width = src.clientWidth; objDragItem.style.background = dragColor; objDragItem.style.fontColor = src.currentStyle.fontColor; objDragItem.style.position = "absolute"; objDragItem.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=75)"; objDragItem.selectIndex = src.selectIndex; while (c.offsetParent != null) { objDragItem.style.y += c.offsetTop; objDragItem.style.x += c.offsetLeft; c = c.offsetParent; } objDragItem.style.borderStyle = "dashed"; objDragItem.style.borderWidth = "1px"; objDragItem.style.display = "none"; src.insertBefore(objDragItem); } function onMouseMove(e) { if(!bDragMode || !objDragItem) return; // If we aren't dragging or our object is null, we return // Hardcoded value for height difference var midWObj = objDragItem.style.posWidth / 2; var midHObj = 12; // Save mouse's position in the document var intTop = e.clientY + element.document.body.scrollTop; var intLeft = e.clientX + element.document.body.scrollLeft; var cx=0,cy=0; var elCurrent = objDragItem.offsetParent; if (elCurrent != null) { while (elCurrent.offsetParent != null) { cx += elCurrent.offsetTop; cy += elCurrent.offsetLeft; elCurrent = elCurrent.offsetParent; } } objDragItem.style.pixelTop = intTop - cx - midHObj; objDragItem.style.pixelLeft = intLeft - cy - midWObj; if(objDragItem.style.display == "none") objDragItem.style.display = ""; iArrayHit = CheckHit(intTop , intLeft , e); e.cancelBubble = false; e.returnValue = false; } function CheckHit(x,y,e) { midWObj = objDragItem.style.posWidth / 2; midHObj = 12; for(var i=0; i < ColumnCount; i++) { if( (y) > (arrHitTest[i][0]) && (y) < (arrHitTest[i][3] )) { ChangeHeader(i); return i + 1; } } return -1; } // // Copy from row to row.. Does the Header also. // function CopyRow(from, to) { if(from == to) return; var origfrom = from; var origto = to; var iDiff = 0; if( from > to ) { iDiff = from - to; var saveObj = headRow.children[from].innerHTML; var saveWidth = headRow.children[from].width; for(var i = 0; i < iDiff; i++) { headRow.children[from].innerHTML = headRow.children[from - 1].innerHTML; headRow.children[from].width = headRow.children[from - 1].width; from--; } headRow.children[to].innerHTML = saveObj; headRow.children[to].width = saveWidth; } else { iDiff = to - from; var saveObj = headRow.children[from].innerHTML; var saveWidth = headRow.children[from].width; for(var i = 0; i < iDiff; i++) { headRow.children[from].innerHTML = headRow.children[from + 1].innerHTML; headRow.children[from].width = headRow.children[from + 1].width; from++; } headRow.children[to].innerHTML = saveObj; headRow.children[to].width = saveWidth; } for(var i = 0; i < headRow.children.length; i++) headRow.children[i].selectIndex = i; InitHeader(); for ( var iRowInsert = 0; iRowInsert < tbody.rows.length; iRowInsert++ ) { from = origfrom; to = origto; if( from > to ) { iDiff = from - to; var saveObj; try { saveObj = tbody.children[iRowInsert].children[from].innerHTML; } catch(e) { saveObj = null; } for(var i = 0; i < iDiff; i++) { try { tbody.children[iRowInsert].children[from].innerHTML = tbody.children[iRowInsert].children[from - 1].innerHTML; from--; } catch(e) {} } if (saveObj != null) tbody.children[iRowInsert].children[to].innerHTML = saveObj; } else { iDiff = to - from; var saveObj; try { saveObj = tbody.children[iRowInsert].children[from].innerHTML; } catch(e) {} for(var i = 0; i < iDiff; i++) { try { tbody.children[iRowInsert].children[from].innerHTML = tbody.children[iRowInsert].children[from + 1].innerHTML; from++; } catch(e) {} } try { tbody.children[iRowInsert].children[to].innerHTML = saveObj; } catch(e) {} } } //////// var buf = ""; for(var i=0; i<headRow.children.length; i++) { var td = headRow.children[i]; tmp = td.innerHTML; pos = tmp.indexOf("<"); if (pos > 0) tmp = tmp.substring(0, pos); else { if (pos == 0) tmp = td.innerText; } buf += tmp; if (i < headRow.children.length-1) buf += ","; } // Go up in the hierarchy until the FORM is found var obj = element.parentElement; while (obj.tagName != "FORM") { obj = obj.parentElement; if (obj == null) return; } //var hiddenField = "__COLUMNORDER_" + element.id; var hiddenField = element.id; // same ID of the server side control if (hiddenField != null) obj[hiddenField].value = buf; } </script> deixando o arquivo html e o dragdrop.htc na mesma pasta, quando a pagina é carregada, temos a opção de trocar a ordem das colunas, mas so funciona no IE, no Mozilla a tabela apenas é carrega, mas a opção de fazer dragdrop não e ativada? Se alguém puder me ajudar, estou precisando muito.
  14. Por que o Mozilla não reconhece este esta propriedade abaixo? style="behavior:url(dragdrop.htc)"
  15. Não sei se o título da mensagem esta apropriado Mas eu gostaria de sabe se existe alguma forma de burlar um script Eu tenho uma pagina, com varios select , quando clico em um button pego o valor de todos os select e concateno e passo para um textbox Na programação em c# eu recupero o valor deste textbox e salvo no Banco de Dados Desta forma, somente ira para o textbox valores que estiver no select, ou seja, eu so passo para o select os valores que o usuario podera salvar no banco de dados Tem alguma forma de burlar isto, ou seja, tem alguma maneira do usuario passar qualquer valor para este textbox?
  16. Preciso recuperar o valor de todos os input type=text da pagina Tentei fazer assim var nTxt = document.getElementsByTagName('input'); for(i=0;i<nTxt.length;i++){ if (nTxt.type == "text" ){ alert(nTxt.value); } } Mas eu não concigo recuperar qual é o type dos input, como eu devo fazer?
  17. sim, ficou perfeito.... valeu, você me ajudou muito
  18. estou passando o id da select DataGrid1__ctl2_SelectContinua Então este "if" procura no conteudo da linha se existe alguma string igual a este id? Seria isto?
  19. Se eu passar o id to input como parametro o que este if faz?
  20. acessando link acima que o Illidan passou eu achei este outro link Mas so da certo no IE, no Mozilla não da certo, porque?
  21. vou fazer uns teste aqui.......
  22. Pode ser um campo texto sim, normal, como os outros...
  23. Crystian eu fiz assim var indexRow = "null"; // Rotina para identificar o index da linha function achaIndex(objLinha) { var objTabela = document.getElementById("DataGrid1"); indexRow = "null"; for (i=0; i < objTabela.rows.length; i++) { if (objTabela.rows[i] == objLinha) { indexRow = i; } } } na tr eu fiz assim <tr onClick="achaIndex(this);"><td>1</td></tr> e coloquei um input assim <INPUT onclick="deleteRow()" type="button" value="Excluir"> e a function // Rotina para excluir function deleteRow(){ if (indexRow != "null"){ document.getElementById("DataGrid1").deleteRow(indexRow); indexRow = "null"; } } Fazendo desta forma, o usuario clica na linha que quer excluir e depois no botão Excluir, esta perfeito..... Mas dentro destas linha eu tenho celulas que contem cada uma um <input type=text>. Eu gostaria de passar o index da linha para a variavel indexRow , quando algum destes input recebecem o focu Mas se eu fizer assim, não da certo <input type=text onFocus="achaIndex(this);"> Por estara passando por parametro para a "achaIndex" as propriedades do <input> ao invés das propriedades da <tr> Como poderia fazer para executar a function achaIndex quando o input receber o focu?
  24. Basta apenas que voce tenha um leitor de codigo de barra, ele é ligado na porta do teclado (ps2) , mas acho que dever ter usb tambem Este aparelho funciona +/- como um teclado, quando você passa o codigo de barra do produto sobre os leds do leitor ele decifra este codigo e envia para o PC os numeros Ou seja, se o curso da aplicação estiver em um campo tipo textBox , o numero ira aparecer como se você tivesse digitado Qualquer coisa pergunta ai.....
×
×
  • Criar Novo...