Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [Javascript] Aiutino con Array

    Ciao ho scaricato una funzione per la creazione di ToolTip Dinamici.
    In una prima parte vengono dichiarati degli array di valori in questo modo :

    codice:
    Text[0]=["Cosnet Faq.","Click to View/Hide the Answer."]
    //Admin
    Text[1]=["Admin Section.","Click Here to open Admin Section."]
    //Address
    Text[2]=["Address Section.","Click Here to open Address Application."]
    Dopo nell' evento mouseOver di un link, passo questa funzione :

    codice:
    onmouseover="stm(Text[8],Style[9]);"
    Dove Text è l' array passato per il testo e Style per lo stile.

    Questa è la funzione stm :

    codice:
    function stm(t,s) {
      if(sNav) {
      	if(t.length<2||s.length<25) {
    		var ErrorNotice = "DHTML TIP MESSAGE VERSION 1.2 ERROR NOTICE.\n"
    		if(t.length<2&&s.length<25) alert(ErrorNotice+"It looks like you removed an entry or more from the Style Array and Text Array of this tip.\nTheir should be 25 entries in every Style Array even though empty and 2 in every Text Array. You defined only "+s.length+" entries in the Style Array and "+t.length+" entry in the Text Array. This tip won't be viewed to avoid errors")
    		else if(t.length<2) alert(ErrorNotice+"It looks like you removed an entry or more from the Text Array of this tip.\nTheir should be 2 entries in every Text Array. You defined only "+t.length+" entry. This tip won't be viewed to avoid errors.")
    		else if(s.length<25) alert(ErrorNotice+"It looks like you removed an entry or more from the Style Array of this tip.\nTheir should be 25 entries in every Style Array even though empty. You defined only "+s.length+" entries. This tip won't be viewed to avoid errors.")
     	}
      	else {
    		var ab = "" ;var ap = ""
    		var titCol = (s[0])? "COLOR='"+s[0]+"'" : ""
    		var txtCol = (s[1])? "COLOR='"+s[1]+"'" : ""
    		var titBgCol = (s[2])? "BGCOLOR='"+s[2]+"'" : ""
    ... ... ...
    Come posso passare io i valori dell' array Text al posto di dover creare 10mila array di tooltip già pronti??

    Es:

    codice:
    onmouseover="stm(Text["Titolo","Testo"],Style[9]);"
    Premetto che cosi' mi da errore ...

  2. #2
    Scusate ma ero poco preparato sugli Array

    codice:
    onmouseover="stm(['Titolo','Testo'],Style[9]);"

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 © 2026 vBulletin Solutions, Inc. All rights reserved.