Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vista IE7 javascript no longer return false

Status
Not open for further replies.

adamroof

Programmer
Nov 5, 2003
1,107
US
Has any one experienced and resolved blocking postbacks with the OnClientClick="return false;" tag on an asp link button or asp button?

It works "fine" with IE7 and XP/2003 server and lower, however i just bot a new box with vista home premium, and my IE7 no longer allows the above funtion to work as previously expected.

What i use it for is to show or hide divs, and do other client side events. I use the asp tags so that way i can pass in the dynamic control name when used in a master/content page (ctl00_ctl01_btnShowDiv, i.e.)

Code:
<asp:LinkButton ID="lbShowAttachments" runat="server" Text="Upload My Own Photos" OnClientClick="showDiv(this,'divAddAtach');return false;" />

My js function showDiv works fine because it works in all other OS's n browsers, just not IE7 vista.

It should show the div and not postback, however it is posting back effectively resetting the div back to display: none;

Thanks for any input.

 
i've found a resolution, but it kind of angers me!

Code:
...
//show
document.getElementById(divToShow).className = "divTabContentView";
[b]event.returnValue=false;[/b]

It should have nothing to do with browser security setttings because we cannot ask all of our end users whomever they may be to change something in their browsers to get JS code to work as it has for years before.

for my inline OnClientClick events, i need to just replace return false; with event.returnValue=false;

My concern with this is will that work on all OS's and all browsers? Can i get your help confirming some different OS's, as i only have Windows?

Im downloading Safari and Firefox to test those browsers on Vista to make sure the above works there too.

Its just over the years i have used the return false in so many areas, it's going to be fun finding them all to be "Vista Ready".

The external js files i use wont be too hard, but finding the inline code will be tricky. I guess it will help somewhat in the long run.
 
UPDATE: Vista and Firefox has the same problem, however the event.returnValue=false does not work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top