Pesquisar no site de suporte

Evite golpes de suporte. Nunca pedimos que você ligue ou envie uma mensagem de texto para um número de telefone, ou compartilhe informações pessoais. Denuncie atividades suspeitas usando a opção “Denunciar abuso”.

Saiba mais

Esta discussão foi arquivada. Faça uma nova pergunta se precisa de ajuda.

Firefox sometimes donnot load javascript alerts correctly

  • 2 respostas
  • 30 têm este problema
  • 459 visualizações
  • Última resposta de th3k3ymast3r

more options

I`m developing a website and sometimes when a javascript alert box is supposed to be showed, it is not displayed properly. It happens all the time, and the most common case is when the user try to log in with wrong username or password, in which case after a few tries the javascript alert box stop beeing shown.

I`m developing a website and sometimes when a javascript alert box is supposed to be showed, it is not displayed properly. It happens all the time, and the most common case is when the user try to log in with wrong username or password, in which case after a few tries the javascript alert box stop beeing shown.

Todas as respostas (2)

more options

I do not know if this helps, but I had the same error. Alert worked in Chrome, Explorer and Safari, but not in Firefox.
In my fal was the error that I tried to send the value directly with the javascript call. Code that did not work in Firefox:

<input name="txtEmail" type="text" class="text" id="txtEmail" style="width:200px;" />
<input name="button" type="button" class="text" id="button" value="&gt;&gt;" onClick="javascript:sendMeNews(txtEmail.value);"/>


If, however, I get the value from inside the javascript function, it worked perfectly.

function sendMeNews(){
	var email = document.getElementById("txtEmail").value;
	var checkPos = email.indexOf("@")
	if (email.length==0 || checkPos=='-1'){
	alert("A valid e-mail address must be filled")
	}
	else
	{
	url="sendNews.asp?email=" + email;
	window.location.href=url;
	}
}


Hope that helps

WebGhost

Alterado por cor-el em

more options

My error is similar but firebug reports the following error on any use of the javascript alert function:

code: alert("Please work...");

script error: Permission denied for <http://localhost> to call method Window.alert

However, if I load the same page at the same location on IE the alert function is called successfully?

Before you cry wolf on local permissions; executing the function on the following page, hosted on a public domain, returns nothing - with the exception that firebug reports no error.

http://www.w3schools.com/JS/tryit.asp?filename=tryjs_alert

I'm using Firefox 3.6.15 on Windows XP Pro SP3

Regards, Leigh