TwelvestoneFront End

simple javascript question


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
WingNut
 
2009-12-02

why does this work: " onClick="javascript:return confirm('Are you sure you want to delete this country ?')">X DELETE COUNTRY X

and by work, i mean when the alert box pops up and if you click "cancel" nothing happens, but if you click "submit" then it goes to the href location.

but not this:

with the code pulling in a function, both the "submit" and "cancel" buttons go to the href location.

" onclick="check_delete()">X DELETE COUNTRY X

with this js function in the header: function check_delete(){return confirm(' Are you sure you want to DELETE this country?');}

the real me
 
2009-12-02

try your second link like this

" onclick="return check_delete()">X DELETE COUNTRY X

with a return in your onclick

WingNut
 
2009-12-02

thanks!

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFront End

simple javascript question