I’m building an aspx page with a button that calls another page in a different window, through javascript:
function assuntos() {
window.open("pg_assuntos.aspx", "List", "scrollbars=no,resizable=no,width=600,height=480");
}
in the page’s Onload event, I have the code:
bot_cadastrar.Attributes.Add("onclick", "assuntos()")
When I click the button, all gonna be right. But everytime I update a fild that execute a query, the “onclick” event seems to be raised or function seems to be executed, because the window is opened. I also have another code in the onload event for starting a stopwatch javascript function:
VB CODE:
Dim script = "<script language = javascript>" & _
"window.setTimeout('ShowTime()', 1000);</script>"
ClientScript.RegisterStartupScript(Me.GetType, "iniciar", script)
ASPX CODE (javascript):
function ShowTime() {
var dt = new Date();
var dif = dt - dtIn;
var tim = new Date();
tim.setHours(0, 0, 0, dif);
document.getElementById("<%= cmp_hora.ClientID %>").value = dt.toLocaleTimeString();
document.getElementById("<%= cmp_tempo.ClientID %>").value = tim.toLocaleTimeString();
window.setTimeout("ShowTime()", 1000);
}
Why the function is starting for itself? I’m fed up whith these popups!
because you need to return false on the javascript call on assuntos function