Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I am doing one shopping cart project.I have one client side button.Its click event is not working in safari browser in mac.I cant find the exact issue.I think my javascript 'theForm' variable is not working in safari.because 'theForm' variable defined an error in safari browser while adding products to cart.

Code is:

C#
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>


===EDIT: Added Code. Please update your question when providing information or changes.===
CodingK
Posted
Updated 25-Nov-14 6:01am
v2
Comments
[no name] 25-Nov-14 6:58am    
What's the code and specific error?
Aradhana Krishna 25-Nov-14 7:03am    
Sorry.I didnt get any error.Button is in disable mode.
Please find the code below:

//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
Sergey Alexandrovich Kryukov 25-Nov-14 15:47pm    
Why doing it this way? The input element of the "submit" type itself submits the form. And it does work, even with Safari browser in Mac. :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900