javascript - Span tag onclick loads blank page? -


i've got span tag:

<span id="mybtnfb"     class="demo" onclick="open()">     <span class="icon">&nbsp;</span>     <span class="">testing</span> </span>  

and javascript

  function open() {       alert('hello');   } 

now, want happen when span clicked, fires function "open". seems happen though reloads page brings blank page. ideas?

http://jsfiddle.net/qtf5s/

open() native javascript function, opens new page (in case blank since there's no params specified): http://www.w3schools.com/jsref/met_win_open.asp

just rename function openalert(): http://jsfiddle.net/qtf5s/2/.

also, @ian mentioned in comments in jsfiddle, it's best change javascript wrap "no wrap - in " code works.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -