Visualizzazione dei risultati da 1 a 5 su 5

Discussione: intercettare mouse

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    667

    intercettare mouse

    Ciao ragazzi,

    io me ne esco sempre con le cose complicated,

    una pizza a chi mi aiuta ...non da mangiare

    Scherzo......

    Ho una funzione che scorre dei record presenti in un div [era il vecchio post scorrere tabella] con la pressione della freccia su e giu. Se clicco il mouse non dovrebbe fare lo scrolling.

    ma non posso fare una cose del genere:

    if(document.onmousedown.event.button==2){
    //non spostare
    }

    devo x forza chiamare una funzione e settare una var a 1 per capire che ho cliccato con il mouse??

    function pippo(){
    alert(event.button)
    mouse=1
    }
    document.onmousedown=pippo


    Grazie baby

  2. #2
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Prova cosi....

    codice:
    <input type="button" id="upa" value="Up" onmousedown="if (event.button==1) {stopScrollLeft=false;setScrollObjects(document.getElementById('a'),document.getElementById('b'));}" onmouseup="stopScrollLeft=true;setScrollObjects(null,null);">
    <input type="button" id="downa" value="Down" onmousedown="if (event.button==1) {stopScrollRight=false;setScrollObjects(document.getElementById('a'),document.getElementById('b'));}" onmouseup="stopScrollRight=true;setScrollObjects(null,null);">

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    667
    Ehila Badaze.... il mio mito.....

    sto cercando di adattare il clicca riga allo scorrimento del div [scorrere lista table]...che tu gentilmente mi hai fornito, quindi non penso mi possa essere utile il codice scritto qui sotto.Scorro la lista non con i button ma con le frecce su e giù.

    post

    Per ora ho risolto richiamando la function.

    Dimmi another cosa, non so se hai letto un mio vecchio post. Hai qualcosa del genere o credi si possa fare?????

    post scorrere table

    Grazie mille....Bello

  4. #4
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Ti propongo questo (che ricava tutte le righe possibili per una ricerca a partire da una colonna qualsiasi)

    codice:
    <HTML>
    <HEAD>
    		 <TITLE>Selezione da una lista digitando i caratteri in un TextBox</TITLE>
    <HEAD>
    <style type="text/css">
    <!--
    .inverted {color:white;background-color:navy} 
    -->
    </style>
    
    <SCRIPT>
    <!--
    var previousRow = null;
    var tdArray     = new Array();
    
    function find() {
     //----------- Colonna da trattare
     colToProcess = document.getElementById('selezionaPer').value; 
     //----------- Stringa da controllare
     stringToFind = document.getElementById('input1').value;
     stringToFind = stringToFind.toLowerCase(); 
     //==============================================================
     //----------- N° delle righe della tabella
     rows         = document.getElementById('stati').rows.length; 
     //----------- Ripristino della class delle righe
     for (i=0;i<rows;i++) {
      currentRow = document.getElementById('stati').rows.item(i)
      currentRow.className = "";
     } // for (i=0;i<rows;i++) 
     
     //==============================================================
     //----------- Assegnazione di un'id in caso la cella non ne avesse
     //            Inserimento delle celle in un array
     autoId   = 0;
     indexArr = 0;
     for (i=0;i<rows;i++) {
      currentRow = document.getElementById('stati').rows.item(i)
    	//------------ si assume che la colonna da controllare sia quella selezionata dalla select
    	controlledCell = parseInt(colToProcess);
    	currentCell     = currentRow.cells.item(controlledCell);
      if (currentCell.id == "") {
    	 currentCell.id = "auto"+autoId;
    	 autoId++;
    	} // if (currentCell.id == "")
    	//------------ Inserimento dell'id nell'array
    	tdArray[indexArr++] = currentCell.id;	 
     } // for (i=0;i<rows;i++) 
    
     //==============================================================
     //----------- Ricerca se esistono celle i cui valori cominciano per stringToFind
     arrResult  = new Array();
     iarrResult = 0;
     found      = false;
     for (i=stringToFind.length;i>0;i--) {
      if (! found) {
       for (j=0;j<tdArray.length;j++) {
        currentCell     = document.getElementById(tdArray[j]);
    	  currentCellText = currentCell.innerHTML;
    	  currentCellText = currentCellText.toLowerCase();	 
    	  if (currentCellText.substr(0,i) == stringToFind.substr(0,i)) {
    	   if (stringToFind.substr(i+1,stringToFind.length-i) >= currentCellText.substr(i+1,stringToFind.length-i)) {
    		  arrResult[iarrResult++] = tdArray[j];
    			found                   = true;
    	   } // if (stringToFind.substr(i+1,stringToFind.length-i) >= currentCellText.substr(i+1,stringToFind.length-i))
    	  } // if (currentCellText.substr(0,i) == stringToFind.substr(0,i))
    	 } // for (j=0;j<tdArray.length;j++
      } // if (! found) 
     } // for (i=stringToFind.length;i>=0;i--)
    
     //==============================================================
     //----------- Assegnazione della classe ai td presenti nell'array
     for (i=0;i<arrResult.length;i++) {
      curRow = document.getElementById(arrResult[i]).parentElement;
    	curRow.className = "inverted";
     } // 
     
     //==============================================================
     //----------- Disassegnazione di un'id in caso la cella non ne avesse uno prima
     for (i=0;i<rows;i++) {
      currentRow = document.getElementById('stati').rows.item(i)
      cells = currentRow.cells.length;
    	//------------ si assume che la colonna da controllare sia quella selezionata dalla select
    	controlledCell = parseInt(colToProcess);
    	for (j=0;j<cells;j++) {
    	 currentCell     = currentRow.cells.item(controlledCell);
    	 currentCellId   = currentCell.id;
       if (currentCellId.substr(0,4) == "auto") {
    	  currentCell.id = "";
    	 } // if (currentCellId.substr(0,4) == "auto")
    	} // for (j=0;j<cells;j++)
     } // for (i=0;i<rows;i++)  
     
     if (arrResult.length == 0) {
      alert("non trovato");
    	return false;
     } //if (arrResult.length == 0)
     
     return true; 
    } // function find()
    //-->
    </SCRIPT>
    
    </HEAD>
    <BODY BGCOLOR="#ffffff">
    <FORM NAME="modulo">
    
    Seleziona per
    <select id="selezionaPer">
     <option value="0">Colonna 1</option>
     <option value="1">Colonna 2</option>
    </select>
     
    <INPUT TYPE="text" NAME="input1" ID="input1" VALUE="Scrivi..." CLASS="" > 
    <INPUT TYPE="button"  VALUE="Cerca" onclick="find()" >
    
    
     <DIV ID="container" 
       STYLE="height:200px; width:350;z-index=100;font-family:verdana;font-size:9pt;overflow: auto;">
    		 <TABLE id="stati" NAME="stati" BORDER="1">
    <TR><TD>Albania</TD><td>diventano </td></TR>
    <TR><TD>Cayman Islands</TD><td>vorrei </td></TR>
    <TR><TD>Central African Rep.</TD><td>record </td></TR>
    <TR><TD>Chad</TD><td>Grazie </td></TR>
    <TR><TD>Chile</TD><td>blu </td></TR>
    <TR><TD>China</TD><td>freccia </td></TR>
    <TR><TD>Christmas Island</TD><td>cene </td></TR>
    <TR><TD>Gambia</TD><td>palle </td></TR>
    <TR><TD>Georgia</TD><td>diventano </td></TR>
    <TR><TD>Germany</TD><td>Fattibile</td></TR>
    <TR><TD>Ghana</TD><td>tempo </td></TR>
    <TR><TD>Gibraltar</TD><td>occhiata</td></TR>
    <TR><TD>Great Britain (UK)</TD><td>dirai</td></TR>
    <TR><TD>Greece</TD><td>scriptino </td></TR>
    <TR><TD>Greenland</TD><td>uccidere </td></TR>
    <TR><TD>Grenada</TD><td>seguente </td></TR>
    <TR><TD>Guadeloupe (Fr.)</TD><td>righe </td></TR>
    <TR><TD>Guam (US)</TD><td>diventano </td></TR>
    <TR><TD>Guatemala</TD><td>occhiata</td></TR>
    <TR><TD>Guinea</TD><td>riga </td></TR>
    <TR><TD>Guinea Bissau</TD><td>spezzate </td></TR>
    <TR><TD>Guyana</TD><td>forum </td></TR>
    <TR><TD>Italy</TD><td>seguente </td></TR>
    <TR><TD>Ivory Coast</TD><td>occhiata</td></TR>
    </TABLE>
    </div>
    </FORM>
    <div id="o"></div>
    </BODY>
    </HTML>

  5. #5
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    667
    Ehi Badaze,

    ho letto solo ora la tua risp..... porco giuda.....favoloso....è perfect.....ora ci abbino lo scrolling come script precedente...o meglio ci provo....

    Mitico Bada


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.