Ciao a tutti, ho un problema con un piccolo script che deve controllare due valori, dopo il caricamento della pagina, e se il risultato è false effettua un redirect:
	
	
	
		
html
	
	
	
		
Di js ne so veramente poco, sicuramente il codice che ho postato sarà una completa castroneria.
Ovviamente non funziona!
Con firebug ricevo questo errore:
	
	
	
		
 
Mi date qualche dritta?
Grazie
				
			
		Codice:
	
	function checkfs()
{	
	if (document.getElementById("rating").value == 3 && document.getElementById("check.countpl").value > 10){
		alert("test");
                return false;
		window.location.href = 'mypage.php';
		} else {
			return true;
			}	
	}	
	window.onload = checkfs();
	html
		HTML:
	
	<input name="countpl" id="countpl" type="hidden" value="<?php echo $row_checkfs['count(f_player.id)']; ?>"/>
<input name="rating" id="rating" type="hidden" value="<?php echo $row_checkfs['rating']; ?>"/>
	Di js ne so veramente poco, sicuramente il codice che ho postato sarà una completa castroneria.
Ovviamente non funziona!
Con firebug ricevo questo errore:
		Codice:
	
	TypeError: document.getElementById(...) is null
	Mi date qualche dritta?
Grazie
			
				Ultima modifica: