HTML Form onclick calling javascript function and later calling the default form action -


i having asp page.

in have form element action specified

now in form have element calling js func on click of 1 button.

it calling javascript function , later calling default form action.

why so?

how can execute function..?

code:

<form method="post" action="update.asp" id=form name=form1 >      <td align=center width=10%><input id=button1 type=submit onclick="gs_test()"  onmouseover="style.backgroundcolor='blue'" onmouseout="style.backgroundcolor='blue'" value=abc name=submit1  style="width: 80%; height: 20px;background:blue; color:white; font-family:serif; font-size=medium; border- color:black; border-width:1px"  ></td>  <script language="javascript">  function gs_test()  {  alert("gss");  }  </script> 

'

change type="submit" type="button". read <input> reference on mdn.

and sake of all, consistent in html... don't mix uppercase, lowercase, " , nothing around attributes, etc... also, don't mix css , javascript html, put them different files. later grateful did.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -