Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

window.open problem

 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have
a href='' on click='callfn'

in the callfn
i call window.open ,with _blank ie open in new window, based on some conditions.
It calls window.open correctly but it also puts the contents which are in this new window on the parent window which I dont want.
i.e it is opening new window with correct contents but also
submitting to the main window.

Would appreciate any inputs on how to get rid of the contents on parent window.

Thanks,
Gayatri
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onclick="fnc();return false;"

Eric
 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that works.
But I don't understand why I need to return false after the call.
Thanks,
Gayatri
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the link is doing its default behavior. If you return false, it cancels it from executing.

Eric
 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic