These functions work just fine in Firefox for Win or Mac, however,
they don''t work at all in IE or Safari. Using Safari''s
debugger, I''m
told there is a Syntax error on line 22 [ var updateDB = function
(class,divid,tn,fn,identifier,value) ], but I just don''t see it.
Each of these functions is being called from an onclick event except
showAllOutput(), which is called from the body''s onload event.
I''ve
also tried declaring these functions in the normal "function showForm
()" way with no difference in results. Am I missing something here?
var showForm = function(fn,identifier)
{
var output = $(''output''+fn+identifier).hide();
var input = $(''input''+fn+identifier).show();
var waiting = $(''waiting''+fn+identifier).hide();
}
var showOutput = function(fn,identifier)
{
var output = $(''output''+fn+identifier).show();
var input = $(''input''+fn+identifier).hide();
var waiting = $(''waiting''+fn+identifier).hide();
}
var showWaiting = function(fn,identifier)
{
var output = $(''output''+fn+identifier).hide();
var input = $(''input''+fn+identifier).hide();
var waiting = $(''waiting''+fn+identifier).show();
}
var updateDB = function(class,divid,tn,fn,identifier,value)
{
var url = ''update.php'';
var params =
''class=''+class+''&divid=''+divid+''&tn=''+tn+''&fn=''+fn
+''&id=''+identifier+''&value=''+value;
new Ajax.Request(url, {
method: ''post'',
parameters: params,
onCreate: function() {
var div = $(''input''+divid);
showWaiting(fn,identifier);
},
onSuccess: function(transport) {
alert(transport.responseText);
showOutput(fn,identifier);
}
});
}
var showAllOutput = function()
{
var inputArray = document.getElementsByClassName(''input'');
var outputArray = document.getElementsByClassName(''output'');
var waitingArray =
document.getElementsByClassName(''waiting'');
for(i=0;i<inputArray.length;i++)
{
$(inputArray[i]).hide();
}
for(i=0;i<waitingArray.length;i++)
{
$(waitingArray[i]).hide();
}
for(i=0;i<outputArray.length;i++)
{
$(outputArray[i]).show();
}
}
--Josh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
var updateDB = function(class,divid,tn,fn,identifier,value) {
// ...
"class" is a [future] reserved word in Javascript. Use a different
variable name.
http://developer.mozilla.org/en/docs/
Core_JavaScript_1.5_Reference:Reserved_Words
TAG
On Aug 13, 2007, at 10:16 AM, Josh Carroll wrote:
>
> These functions work just fine in Firefox for Win or Mac, however,
> they don''t work at all in IE or Safari. Using Safari''s
debugger, I''m
> told there is a Syntax error on line 22 [ var updateDB = function
> (class,divid,tn,fn,identifier,value) ], but I just don''t see it.
> Each of these functions is being called from an onclick event except
> showAllOutput(), which is called from the body''s onload event.
I''ve
> also tried declaring these functions in the normal "function showForm
> ()" way with no difference in results. Am I missing something here?
>
>
> var showForm = function(fn,identifier)
> {
> var output = $(''output''+fn+identifier).hide();
> var input = $(''input''+fn+identifier).show();
> var waiting = $(''waiting''+fn+identifier).hide();
> }
>
> var showOutput = function(fn,identifier)
> {
> var output = $(''output''+fn+identifier).show();
> var input = $(''input''+fn+identifier).hide();
> var waiting = $(''waiting''+fn+identifier).hide();
> }
>
> var showWaiting = function(fn,identifier)
> {
> var output = $(''output''+fn+identifier).hide();
> var input = $(''input''+fn+identifier).hide();
> var waiting = $(''waiting''+fn+identifier).show();
> }
>
> var updateDB = function(class,divid,tn,fn,identifier,value)
> {
> var url = ''update.php'';
> var params =
''class=''+class+''&divid=''+divid+''&tn=''+tn+''&fn=''+fn
>
+''&id=''+identifier+''&value=''+value;
>
> new Ajax.Request(url, {
> method: ''post'',
> parameters: params,
> onCreate: function() {
> var div = $(''input''+divid);
> showWaiting(fn,identifier);
> },
> onSuccess: function(transport) {
> alert(transport.responseText);
> showOutput(fn,identifier);
> }
> });
> }
>
> var showAllOutput = function()
> {
> var inputArray =
document.getElementsByClassName(''input'');
> var outputArray =
document.getElementsByClassName(''output'');
> var waitingArray =
document.getElementsByClassName(''waiting'');
>
> for(i=0;i<inputArray.length;i++)
> {
> $(inputArray[i]).hide();
> }
> for(i=0;i<waitingArray.length;i++)
> {
> $(waitingArray[i]).hide();
> }
> for(i=0;i<outputArray.length;i++)
> {
> $(outputArray[i]).show();
> }
> }
>
> --Josh
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Ahhhh! I KNEW it would be something dumb like that. Thanks for tolerating me! --Josh On Aug 13, 2007, at 11:52 AM, Tom Gregory wrote:> > var updateDB = function(class,divid,tn,fn,identifier,value) { > // ... > > "class" is a [future] reserved word in Javascript. Use a different > variable name. > http://developer.mozilla.org/en/docs/ > Core_JavaScript_1.5_Reference:Reserved_Words > > > TAG > > On Aug 13, 2007, at 10:16 AM, Josh Carroll wrote: > >> >> These functions work just fine in Firefox for Win or Mac, however, >> they don''t work at all in IE or Safari. Using Safari''s debugger, I''m >> told there is a Syntax error on line 22 [ var updateDB = function >> (class,divid,tn,fn,identifier,value) ], but I just don''t see it. >> Each of these functions is being called from an onclick event except >> showAllOutput(), which is called from the body''s onload event. I''ve >> also tried declaring these functions in the normal "function showForm >> ()" way with no difference in results. Am I missing something here? >> >> >> var showForm = function(fn,identifier) >> { >> var output = $(''output''+fn+identifier).hide(); >> var input = $(''input''+fn+identifier).show(); >> var waiting = $(''waiting''+fn+identifier).hide(); >> } >> >> var showOutput = function(fn,identifier) >> { >> var output = $(''output''+fn+identifier).show(); >> var input = $(''input''+fn+identifier).hide(); >> var waiting = $(''waiting''+fn+identifier).hide(); >> } >> >> var showWaiting = function(fn,identifier) >> { >> var output = $(''output''+fn+identifier).hide(); >> var input = $(''input''+fn+identifier).hide(); >> var waiting = $(''waiting''+fn+identifier).show(); >> } >> >> var updateDB = function(class,divid,tn,fn,identifier,value) >> { >> var url = ''update.php''; >> var params = ''class=''+class+''&divid=''+divid+''&tn=''+tn+''&fn=''+fn >> +''&id=''+identifier+''&value=''+value; >> >> new Ajax.Request(url, { >> method: ''post'', >> parameters: params, >> onCreate: function() { >> var div = $(''input''+divid); >> showWaiting(fn,identifier); >> }, >> onSuccess: function(transport) { >> alert(transport.responseText); >> showOutput(fn,identifier); >> } >> }); >> } >> >> var showAllOutput = function() >> { >> var inputArray = document.getElementsByClassName(''input''); >> var outputArray = document.getElementsByClassName(''output''); >> var waitingArray = document.getElementsByClassName(''waiting''); >> >> for(i=0;i<inputArray.length;i++) >> { >> $(inputArray[i]).hide(); >> } >> for(i=0;i<waitingArray.length;i++) >> { >> $(waitingArray[i]).hide(); >> } >> for(i=0;i<outputArray.length;i++) >> { >> $(outputArray[i]).show(); >> } >> } >> >> --Josh >> >>> > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---