Thank you for your help. I tried all of your suggestions, but, unfortunately, the code still doesn't work in Firefox of Safari. I went ahead and defined my output element as a variable. I also put in the conditional statement that Rui Liu suggested. I replaced innerText with innerHTML, which Firefox is supposed to support. I also tried outputting text using element.firstChild and element.appendChild. No luck. No matter what I did, I still got the same result in Firefox and Safari - a full page refresh. IE, on the other hand, worked fine.
Interestingly enough, when I replaced the buttons with images, the code worked in Safari and IE. However, it was still broken in Firefox. In Firefox's Javascript console, I got the following two errors : Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.getResponseHeader]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx :: anonymous :: line 321" data: no] Source File: http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx Line: 321 Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.getResponseHeader]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx :: anonymous :: line 321" data: no] Source File: http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx Line: 321 Does anybody know what these exceptions mean? >Maybee you should start freshup your JavaScript and DOM knowledge. Albert, you are correct - I am pretty new to JavaScript. However, I didn't think that you had to be a JavaScript wizard in order to get AJAX .NET to work with Firefox and Safari. I wish that the creator of AJAX .NET or the community would produce a set of easy example code that I could follow. All of the example code in the starter kits is too complex. I'm sure they will be helpful once I'm familiar with the library, but they aren't helping me to get started. I would think that what I'm trying to do is easy - display text after someone clicks on a button or image. It works fine in IE, but Firefox and Safari are giving me trouble. Thanks to all for your help. Below is the latest revision of my code : This is in my .aspx : <form id="form1" runat="server"> <div> <img src="img/potato.jpg" id="potato"/> <img src="img/tomato.jpg" id="tomato"/> <img src="img/spacesuit.jpg" id="spacesuit"/> <!--<button id="potato">potato</button> <button id="tomato">tomato</button> <button id="spacesuit">spacesuit</button> --> <br /> <div id="output"></div> <script language="javascript" src="Default.js"></script> </div> </form> This is in my .aspx.cs : [AjaxPro.AjaxNamespace("Default")] public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(Default)); } [AjaxPro.AjaxMethod] public string GetTomato() { return "You are eating a tomato!"; } [AjaxPro.AjaxMethod] public string GetPotato() { return "You are eating a potato!"; } [AjaxPro.AjaxMethod] public string GetSpaceSuit() { return "You are eating a spacesuit!"; } } This is in my .js : if (document.all) { vTomato = document.all["tomato"]; vPotato = document.all["potato"]; vSpaceSuit = document.all["spacesuit"]; } else if (document.getElementById) { vTomato = document.getElementById("tomato"); vPotato = document.getElementById("potato"); vSpaceSuit = document.getElementById("spacesuit"); } addEvent(vTomato, "click", GetTomato); addEvent(vPotato, "click", GetPotato); addEvent(vSpaceSuit, "click", GetSpaceSuit); var vOutput = document.getElementById('output'); function setText(ele, text) { /* if (ele.firstChild != null) { ele.firstChild.nodeValue = text; } else { ele.appendChild(document.createTextNode(text)); } */ ele.innerHTML = text; } function GetTomato(ev) { Default.GetTomato(GetTomato_Callback) } function GetTomato_Callback(response) { setText(vOutput, response.value); } function GetPotato(ev) { Default.GetPotato(GetPotato_Callback) } function GetPotato_Callback(response) { setText(vOutput, response.value); } function GetSpaceSuit(ev) { Default.GetSpaceSuit(GetSpaceSuit_Callback) } function GetSpaceSuit_Callback(response) { setText(vOutput, response.value); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ajax.NET Professional" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ajaxpro The latest downloads of Ajax.NET Professional can be found at http://www.ajaxpro.info -~----------~----~----~----~------~----~------~--~---
