Link to home
Start Free TrialLog in
Avatar of R2C
R2C

asked on

JavaScript and .net - [element].attributes.item("onclick") = "SomeFuction(2)" works in Firefox but not in IE

I have a project in which I have created a tab control. As you select a new tab JavaScript validates the current tab before displaying the new one.
This is done by setting the onclick property of the tab to run a JavaScript function. e.g. onclick="ShowTab(2)"
This works fine, the problem I have is I only need to validate the tabs for certain users.
The easiest way I could think to do this is when the .aspx page loads, change the onclick attribute using - TabHeader1.Attributes.Item("onclick") = "ShowTabNoValidation(1)"
This works perfectly in Firefox but not in IE which most of the users will be using. It appears that IE is using the original function which validates the tab! I have tried pasting my JavaScript into another file and referencing it that way but the problem still persists.
Does anyone have any ideas why this might be or have any other suggestions as to another way I can go about doing different client side validation based on the current user?
ASKER CERTIFIED SOLUTION
Avatar of Lolly-Ink
Lolly-Ink
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial