Forums

javascript not runnign

lilla67 28 May, 2010
Sto cercando uno script molto semplice, ma non posso eseguire JavaScript Ho dimenticato qualcosa nel chronoform configurazione (ho disattivato il plugin jquery ma non funziona lo stesso) qualcuno può aiutarmi a capire! Con la versione per Joomla 1.0 non ho mai avuto alcun problema! Grazie

I'm trying a very simple script but I can not run javascript I forgot something in the configuration chronoform (I disabled the plugin but jquery does not work the same) can anyone help me understand! With the version for joomla 1.0 I never had any problem! Thanks
html
<a href="javascript:visualizza('quote')">
<img src=../images/sel+.gif border="0" src="../images/sel-.gif" width="14" height="13" alt="ESPANDI"> </ a> </ td> </ div>


javascript
funzione visualizza (id) (
if (document.getElementById) (
if (document.getElementById (id). style.display == 'none') (
document.getElementById (id). style.display = 'block';
Else ()
document.getElementById (id). style.display = 'none';
)
)
)
GreyHead 29 May, 2010
Hi lilla67,

There may be other problems but the first one I see is that I believe that JavaScript doesn't speak Italian and so
funzione visualizza (id) (
needs to be
function visualizza (id) (

Bob
nml375 29 May, 2010
Hi lilla67 & Bob,
Add to that, you need {} rather than () for the function body:
function visualizza(id) {
  if (document.getElementById(id).style.display == 'none') {
    document.getElementById(id).style.display = 'block';
  } else {
    document.getElementById(id).style.display = 'none';
  }
}


Might also be wize to add a check that the document.getElementById() method actually returns a valid object (not null)...

/Fredrik
lilla67 29 May, 2010
My mistake to make copy and paste the code after the translation, the javascript code I use is this


function visualizza(id)(
if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
}
)

There is a working example that I can use to see if where is my problem, if javascript or other
thanks
nml375 29 May, 2010
Hi lilla67,
You still got some ( and ) in there in the wrong places...

function visualizza(id) {
  if (document.getElementById) {
    if(document.getElementById(id).style.display == 'none') {
      document.getElementById(id).style.display = 'block';
    } else {
      document.getElementById(id).style.display = 'none';
    }
  }
}


/Fredrik
lilla67 08 Jun, 2010
function showhide() {
   var test = document.getElementById('categoria').value;
   if (test == 'Escort') {
         document.getElementById('escort').style.display='block';
   }
   else { document.getElementById('escort').style.display='none'; }
   
 if (test == 'Girl') {
         document.getElementById('girl').style.display='block';
   }
   else { document.getElementById('girl').style.display='none'; }
   
    if (test == 'Boy') {
         document.getElementById('boy').style.display='block';
   }
   else { document.getElementById('boy').style.display='none'; }
   
    if (test == 'Trans') {
         document.getElementById('trans').style.display='block';
   }
   else { document.getElementById('trans').style.display='none'; }
   
    if (test == 'Mistress') {
         document.getElementById('mistress').style.display='block';
   }
   else { document.getElementById('mistress').style.display='none'; }
   
    if (test == 'Coppie') {
         document.getElementById('coppie').style.display='block';
   }
   else { document.getElementById('coppie').style.display='none'; }
   }

Ok for the Javascript code I solved the problem that now works is that there was not email the contents of a hidden div.
What should I do
Help
GreyHead 08 Jun, 2010
Hi lilla67,

Do you have an placeholder like {imput_name} for the hidden field in the Email template?

Bob
This topic is locked and no more replies can be posted.