html - javascript onclick not calling the function -


i trying learn javascript. have little experience in web. pardon me question.

i trying use onclick event function.unfortunately, not load function.

<img id="btnpartdispatch" title="sometitle" class="img-rounded" src="~/content/images/dashboard/partdispatch.png" width="115" height="115" onclick="helloworld()" /> 

function in different file:

function helloworld(){ alert"('hello world')" } 

however, if change onclick event alert("hello world") works fine. this:

<img id="btnpartdispatch" title="sometitle" class="img-rounded" src="~/content/images/dashboard/partdispatch.png" width="115" height="115" onclick="alert('hello world!')" /> 

can tell me wrong? thanks

getting javascript files on way:

@section scripts {      <script type="text/javascript">          var secondstoclosepopup = 1000 *  @functions.getnumberofsecondstoclosepopup();      </script>     <script type="text/javascript" src="@url.content("~/scripts/jquery.multiple.select.js")"></script>     <script type="text/javascript" src="@url.content("~/scripts/service.js")"></script> } 

project asp.net

you have remove double quotes this:

alert"('hello world')" 

in

alert('hello world') 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -