[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-18 Thread ColinFine

Crockford's book (referenced in a previous reply) is only 150 pages
long including the appendices, so it is really not a big read.

Colin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-17 Thread Tobie Langel

JavaScript has got this weird flaw, that if you forget to declare a
variable using the var keyword, the variable is declared in the
global scope instead of the current scope.

For example:

function foo() {
  bar = 1;
  var baz = 2;
}

foo();
console.log(bar);
// - 1
console.log(baz);
// - ReferenceError: baz is not defined

As a rule of thumb: Never declare a variable WITHOUT using the var
keyword. If you want to declare a global variable from inside a
function (which should be a sign you're doing something wrong), set it
as a property of the window object like so:

function foo() {
  window.bar = 1;
}

foo();
console.log(bar);
// - 1

You should really get yourself a couple of books on JavaScript. I'd
strongly suggest getting:

- JavaScript: The Definitive Guide, Fifth Edition by David Flanagan,
and
- JavaScript: The Good Parts by Douglas Crockford

There's also a number of good books on Prototype out there:

- http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous,
and
- 
http://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bungie-book-has-landed

Have fun!

Tobie


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-17 Thread Vinay Seshadri
Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
definitely a must do for me, AFTER this project :D.

On Sun, May 17, 2009 at 12:02 PM, Tobie Langel tobie.lan...@gmail.comwrote:


 JavaScript has got this weird flaw, that if you forget to declare a
 variable using the var keyword, the variable is declared in the
 global scope instead of the current scope.

 For example:

 function foo() {
  bar = 1;
  var baz = 2;
 }

 foo();
 console.log(bar);
 // - 1
 console.log(baz);
 // - ReferenceError: baz is not defined

 As a rule of thumb: Never declare a variable WITHOUT using the var
 keyword. If you want to declare a global variable from inside a
 function (which should be a sign you're doing something wrong), set it
 as a property of the window object like so:

 function foo() {
  window.bar = 1;
 }

 foo();
 console.log(bar);
 // - 1

 You should really get yourself a couple of books on JavaScript. I'd
 strongly suggest getting:

 - JavaScript: The Definitive Guide, Fifth Edition by David Flanagan,
 and
 - JavaScript: The Good Parts by Douglas Crockford

 There's also a number of good books on Prototype out there:

 - http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous,
 and
 -
 http://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bungie-book-has-landed

 Have fun!

 Tobie


 



-- 
In Sport We Trust !!!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-17 Thread T.J. Crowder

Hi,

 Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
 definitely a must do for me, AFTER this project :D.

FWIW, I suspect you'll save time even on this project if you take an
hour to read through the Prototype API[1] from beginning to end,
especially now that you've got your feet wet.  You may not have time
right now to read through Flanagan's or Crockford's books, but an hour
spent with the API will almost certainly pay for itself right away.

[1] http://prototypejs.org/api

Separately, can I also suggest you read up on two fundamental concepts
that may well trip you up otherwise:  Binding and the this keyword
[2], and closures[3].  I've linked some resources about that
(disclaimer: niftysnippets is my blog, not that I post to it much).

[2] 
http://proto-scripty.wikidot.com/prototype:tip-using-an-instance-method-as-a-callback-or-event-handler
(also the articles linked at the bottom of [2])
[3] http://blog.niftysnippets.org/2008/02/closures-are-not-complicated.html

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On May 17, 10:04 am, Vinay Seshadri yourstruly.vi...@gmail.com
wrote:
 Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
 definitely a must do for me, AFTER this project :D.

 On Sun, May 17, 2009 at 12:02 PM, Tobie Langel tobie.lan...@gmail.comwrote:





  JavaScript has got this weird flaw, that if you forget to declare a
  variable using the var keyword, the variable is declared in the
  global scope instead of the current scope.

  For example:

  function foo() {
   bar = 1;
   var baz = 2;
  }

  foo();
  console.log(bar);
  // - 1
  console.log(baz);
  // - ReferenceError: baz is not defined

  As a rule of thumb: Never declare a variable WITHOUT using the var
  keyword. If you want to declare a global variable from inside a
  function (which should be a sign you're doing something wrong), set it
  as a property of the window object like so:

  function foo() {
   window.bar = 1;
  }

  foo();
  console.log(bar);
  // - 1

  You should really get yourself a couple of books on JavaScript. I'd
  strongly suggest getting:

  - JavaScript: The Definitive Guide, Fifth Edition by David Flanagan,
  and
  - JavaScript: The Good Parts by Douglas Crockford

  There's also a number of good books on Prototype out there:

  -http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous,
  and
  -
 http://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun...

  Have fun!

  Tobie

 --
 In Sport We Trust !!!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-17 Thread Vinay Seshadri
Hi Crowder,

I actually did spend a couple of hours on the API a few months back when I
had to write this JS code im talking about. I must admit though, that I
conveniently concentrated only on those methods that I felt I required to
accomplish what I had to. What I really need is to understand the basic
rules and concepts used by and in JS.

Binding and the this keyword [2], and closures[3]

Thanks a lot for those :). Are there any other concepts you would suggest
for a guy with mostly a Ruby and C background? Things i might find differnet
from the kind of coding im used to.

On Sun, May 17, 2009 at 2:59 PM, T.J. Crowder t...@crowdersoftware.comwrote:


 Hi,

  Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
  definitely a must do for me, AFTER this project :D.

 FWIW, I suspect you'll save time even on this project if you take an
 hour to read through the Prototype API[1] from beginning to end,
 especially now that you've got your feet wet.  You may not have time
 right now to read through Flanagan's or Crockford's books, but an hour
 spent with the API will almost certainly pay for itself right away.

 [1] http://prototypejs.org/api

 Separately, can I also suggest you read up on two fundamental concepts
 that may well trip you up otherwise:  Binding and the this keyword
 [2], and closures[3].  I've linked some resources about that
 (disclaimer: niftysnippets is my blog, not that I post to it much).

 [2]
 http://proto-scripty.wikidot.com/prototype:tip-using-an-instance-method-as-a-callback-or-event-handler
 (also the articles linked at the bottom of [2])
 [3]
 http://blog.niftysnippets.org/2008/02/closures-are-not-complicated.html

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On May 17, 10:04 am, Vinay Seshadri yourstruly.vi...@gmail.com
 wrote:
  Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
  definitely a must do for me, AFTER this project :D.
 
  On Sun, May 17, 2009 at 12:02 PM, Tobie Langel tobie.lan...@gmail.com
 wrote:
 
 
 
 
 
   JavaScript has got this weird flaw, that if you forget to declare a
   variable using the var keyword, the variable is declared in the
   global scope instead of the current scope.
 
   For example:
 
   function foo() {
bar = 1;
var baz = 2;
   }
 
   foo();
   console.log(bar);
   // - 1
   console.log(baz);
   // - ReferenceError: baz is not defined
 
   As a rule of thumb: Never declare a variable WITHOUT using the var
   keyword. If you want to declare a global variable from inside a
   function (which should be a sign you're doing something wrong), set it
   as a property of the window object like so:
 
   function foo() {
window.bar = 1;
   }
 
   foo();
   console.log(bar);
   // - 1
 
   You should really get yourself a couple of books on JavaScript. I'd
   strongly suggest getting:
 
   - JavaScript: The Definitive Guide, Fifth Edition by David Flanagan,
   and
   - JavaScript: The Good Parts by Douglas Crockford
 
   There's also a number of good books on Prototype out there:
 
   -
 http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous,
   and
   -
  http://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun.
 ..
 
   Have fun!
 
   Tobie
 
  --
  In Sport We Trust !!!
 



-- 
In Sport We Trust !!!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-17 Thread T.J. Crowder

Hi,

 Thanks a lot for those :). Are there any other concepts you would suggest
 for a guy with mostly a Ruby and C background? Things i might find differnet
 from the kind of coding im used to.

No worries.  Just very quickly off-the-cuff (and you'll find some
posts about this on niftysnippets), in addition to the things we've
already pointed out:

1. Tobie already pointed out the horror of implicit globals.

2. Binding and the this keyword.

3. Closures.

Some further items for the C programmer (I don't know anything about
Ruby):

4. Understand the scope chain.  (Closely related to closures, but good
to know separately as well.)

5. {} blocks _don't_ introduce new scope; only functions do that.

6. Regardless of where you put a var statement, all vars exist
function-wide.  For this reason, I strongly recommend putting all vars
at the beginning of the function (like you used to have to with C,
back in the day), to avoid misunderstandings.

7. Most of the places you're used to using NULL, use undefined.  You
can use null, but it's more common to use undefined.  When testing,
use if (thingy) where you're used to writing if (thingy != NULL)
in C, and similarly if (!thingy) for if (thingy == NULL).

8. The OR (||) operator doesn't return true or false; it returns the
left-hand value (unchanged) if that value can be coerced true (e.g.,
it's truthy), or the right-hand value if the left-hand value can't
be coerced true (it's falsey).  This gets a huge amount of use in
JavaScript code, usually for supplying default values for something
that hasn't been defined.  Take this sort() function:

function sort(comparator) {
comparator = comparator || this.defaultComparator;
// ...
}

In C, that first line wouldn't make any sense because the result would
be -1 (TRUE) or 0 (FALSE); in JavaScript, the result is 'comparator'
if 'comparator' is truthy, or 'this.defaultComparator' if 'comparator'
is falsey.

Be careful about going too far with that, though.  For instance, if
you have an optional numeric argument and zero is a valid value for
the caller to pass in and 42 is the default, you can't use

   arg = arg || 42;

...to default it, because you'll use 42 instead of 0 if the caller
passes in 0 (zero is falsey).  Similarly, an empty string is falsey.

9. Properties are really cool, and you can get at them in many ways.
The following all retrieve the value of the 'bar' property of the
'foo' object and store it in 'x':

A) x = foo.bar;
B) x = foo['bar'];
C) s = 'bar'; x = foo[s];

That last one is convenient for when you don't know the name of the
property in advance.

10. There are no methods.  There are functions, and you can store
references to functions as properties of objects, and there is a
convenient syntax for calling those functions with this set as a
reference to the object during the course of the call, but there are
no methods.  this is effectively a special function argument,
nothing more.

11. for..in does not loop through the index values of an array, so
don't use it for that.  It loops through the names of the properties
on an object (which is very handy), including the names of properties
that refer to functions.

12. The ECMA spec allows for properties that can't be enumerated
(e.g., don't show up in for..in), but you can't mark your own
properties that way.  For instance, for..in on an array won't show
you the length property even though arrays have a length property.
(It also won't show you the pop property, even though arrays have a
pop property -- which references a function.  But it will show you
Prototype's additions to arrays, because we can't mark them not to be
included.  This is why for..in on arrays *seems* to loop through the
array's contents -- until you start extending arrays the way Prototype
does, and then suddenly you're getting function names.)

12. There is a difference between not having a property and having a
property whose value is undefined.  Referencing a property that
doesn't exist gives you undefined (not an error), though, so the
difference can be subtle.  The in keyword tests whether an object
has a property.  delete deletes a property entirely.

foo = {};// Create an empty object
foo.bar = 42;// Give it a 'bar' property
alert(foo.bar);  // Alerts 42
alert('bar' in foo); // Alerts true
foo.bar = undefined; // Set 'bar' to undefined
alert(foo.bar);  // Alerts undefined
alert('bar' in foo); // Alerts true
delete foo.bar;  // Completely remove 'bar' property
alert(foo.bar);  // Alerts undefined
alert('bar' in foo); // Alerts false

Note that if we created foo in a way that it had a prototype with a
'bar' property, the second-to-last alert would be controlled by the
prototype's value for 'bar' and the last alert would be
true (because in looks in prototypes, too).  foo.hasOwnProperty
('bar') checks to see if foo has its *own* 'bar' property (as opposed
to one inherited from its prototype).

13. Prototypical inheritance 

[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-17 Thread Vinay Seshadri
Wow! A generous contribution indeed! Thanks a lot! I'd feel guilty if I dint
read up on it now.. :)
Feels like a whole new world. Especially since using Prototype is actually
directly extending the DOM element. Feels like there's a LOT of power in
good HTML+CSS+JS that can be exploited to do a lot more functions a lot
faster than by using server side scripting.
Thanks again Crowder! My appreciation seems really small in comparison to
your contribution but i really DO mean it :)

On Sun, May 17, 2009 at 4:31 PM, T.J. Crowder t...@crowdersoftware.comwrote:


 Hi,

  Thanks a lot for those :). Are there any other concepts you would suggest
  for a guy with mostly a Ruby and C background? Things i might find
 differnet
  from the kind of coding im used to.

 No worries.  Just very quickly off-the-cuff (and you'll find some
 posts about this on niftysnippets), in addition to the things we've
 already pointed out:

 1. Tobie already pointed out the horror of implicit globals.

 2. Binding and the this keyword.

 3. Closures.

 Some further items for the C programmer (I don't know anything about
 Ruby):

 4. Understand the scope chain.  (Closely related to closures, but good
 to know separately as well.)

 5. {} blocks _don't_ introduce new scope; only functions do that.

 6. Regardless of where you put a var statement, all vars exist
 function-wide.  For this reason, I strongly recommend putting all vars
 at the beginning of the function (like you used to have to with C,
 back in the day), to avoid misunderstandings.

 7. Most of the places you're used to using NULL, use undefined.  You
 can use null, but it's more common to use undefined.  When testing,
 use if (thingy) where you're used to writing if (thingy != NULL)
 in C, and similarly if (!thingy) for if (thingy == NULL).

 8. The OR (||) operator doesn't return true or false; it returns the
 left-hand value (unchanged) if that value can be coerced true (e.g.,
 it's truthy), or the right-hand value if the left-hand value can't
 be coerced true (it's falsey).  This gets a huge amount of use in
 JavaScript code, usually for supplying default values for something
 that hasn't been defined.  Take this sort() function:

function sort(comparator) {
comparator = comparator || this.defaultComparator;
// ...
}

 In C, that first line wouldn't make any sense because the result would
 be -1 (TRUE) or 0 (FALSE); in JavaScript, the result is 'comparator'
 if 'comparator' is truthy, or 'this.defaultComparator' if 'comparator'
 is falsey.

 Be careful about going too far with that, though.  For instance, if
 you have an optional numeric argument and zero is a valid value for
 the caller to pass in and 42 is the default, you can't use

   arg = arg || 42;

 ...to default it, because you'll use 42 instead of 0 if the caller
 passes in 0 (zero is falsey).  Similarly, an empty string is falsey.

 9. Properties are really cool, and you can get at them in many ways.
 The following all retrieve the value of the 'bar' property of the
 'foo' object and store it in 'x':

 A) x = foo.bar;
 B) x = foo['bar'];
 C) s = 'bar'; x = foo[s];

 That last one is convenient for when you don't know the name of the
 property in advance.

 10. There are no methods.  There are functions, and you can store
 references to functions as properties of objects, and there is a
 convenient syntax for calling those functions with this set as a
 reference to the object during the course of the call, but there are
 no methods.  this is effectively a special function argument,
 nothing more.

 11. for..in does not loop through the index values of an array, so
 don't use it for that.  It loops through the names of the properties
 on an object (which is very handy), including the names of properties
 that refer to functions.

 12. The ECMA spec allows for properties that can't be enumerated
 (e.g., don't show up in for..in), but you can't mark your own
 properties that way.  For instance, for..in on an array won't show
 you the length property even though arrays have a length property.
 (It also won't show you the pop property, even though arrays have a
 pop property -- which references a function.  But it will show you
 Prototype's additions to arrays, because we can't mark them not to be
 included.  This is why for..in on arrays *seems* to loop through the
 array's contents -- until you start extending arrays the way Prototype
 does, and then suddenly you're getting function names.)

 12. There is a difference between not having a property and having a
 property whose value is undefined.  Referencing a property that
 doesn't exist gives you undefined (not an error), though, so the
 difference can be subtle.  The in keyword tests whether an object
 has a property.  delete deletes a property entirely.

 foo = {};// Create an empty object
 foo.bar = 42;// Give it a 'bar' property
 alert(foo.bar);  // Alerts 42
 alert('bar' in foo); // Alerts true
 foo.bar = 

[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-16 Thread Tobie Langel

 Tobie, your suggestion dint work. Thanks though.
 Vladimir's did.

Misread your HTML (hint paste large chunk of code in pastie next
time).

Code should have read: $(this).up().previous('.filter').submit();

Vladimir's answer is a lot more expansive, and would break should you
have more than one form on the page.

Please take the time to have a look at the API for $$, Element#up and
Element#previous. It's well worth it.

Best,

Tobie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-16 Thread Tobie Langel

 Could you tell me what the right syntax is that I should be using for
 IE to be able to interpret my code?

You should have a look at the following tutorial:

http://prototypejs.org/learn/extensions

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-16 Thread Ram

Hi Tobie,

THanks a lot for the replies!

I ended up using $(this).up('.filter').submit(); and it works like a
charm and its not as expansive as what Vladimir suggested too :).
I walked through my custom JS and figured out where exactly it broke.

There are places in my JS where i do something like

chem_mark = parseFloat($('student_chem_mark').innerHTML) || 0.00;

OR initializing a float variable with 0 to calculate some stuff and
then INSERTING THE SAME variable back into the page

avg_percent = 0.00
..
$('student_avg').value = avg_percent.

In both these cases, IE works only when I use var chem_mark = or
var avg_percent =. I dont know the whole idea behind it but it just
works now :D. Any idea what the story is behind it?
also, i dont have to mention 'var ' when I do the following

chem_mark = parseFloat($('student_chem_mark').value) || 0.00;

for this of course, 'student_chem_mark' has to be an input field.

On May 16, 10:20 pm, Tobie Langel tobie.lan...@gmail.com wrote:
  Could you tell me what the right syntax is that I should be using for
  IE to be able to interpret my code?

 You should have a look at the following tutorial:

 http://prototypejs.org/learn/extensions
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-15 Thread Ram

This is the smallest piece of custom JS thats NOT working. Is the
method of DOM reference im using wrong? Im using the this.up and
this.down methods all over my custom JS.

Ruby/Rails code

h4Filter Tickets/h4
   pFilter tickets by status./p
form id='filter' class='filter' action=/tickets method=get
p
%= hidden_field_tag :commit, Filter%
%= select_tag status, 
options_from_collection_for_select
(Status.find(:all), :id, :status,selected_status(params
[:status])), :onchange = this.up('.filter').submit() %
/p
/form

Resulting HTML page source

h4Filter Tickets/h4
pFilter tickets by status./p
form id='filter' class='filter' action=/tickets method=get
p
input id=commit name=commit type=hidden value=Filter /
select id=status name=status onchange=this.up('.filter').submit
()option value=1Open/option
option value=2Accepted/option
option value=3In Progress/option
option value=4Completed/option
option value=5 selected=selectedAll/option
option value=6Invalid/option/select
/p
/form
/p

HELP!

On May 15, 3:42 pm, Ram yourstruly.vi...@gmail.com wrote:
 Hi all,

 I just got around to testing my Rails application in IE6 and 7 and I
 discovered that my custom Javascripts (written in Prototype) dont work
 and seem to break the HTML and CSS in the page too.

 Any tips or resources that I can read up to make my JS IE compatible?
 Your experiences and thoughts? I coudl post some of my code here if
 anyone could help me with it.

 Hope to get some pointers.. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-15 Thread Ram

Thanks a lot for both your replies!

Tobie, your suggestion dint work. Thanks though.
Vladimir's did.

I have one page thats simply loaded with custom JS. There a lot of
text fields in it which have a JS hook simliar to
onchange=autofill_record(this) . And these custom JS functions use a
lot of (element).up and (element).down to manipulate user entered
values and perform some calculations and display the results.

Could you tell me what the right syntax is that I should be using for
IE to be able to interpret my code?
Thanks again!

On May 16, 12:38 am, Vladimir Tkach tea...@gmail.com wrote:
 Another one:
 $$('.filter').first().submit()

 --
 Best Regards,
 Vladimir Tkach

 +972-54-7574166
 tea...@gmail.com

 http://teamco-anthill.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Custom JS breaking in IE6,7 - Tips on debugging?

2009-05-15 Thread Ram

A sample of the kind of calculation code im using

function calculate_average( element ) {
  s = element.down('.science').value || 0;
  m = element.down('.math').value || 0;
  a = (parseFloat(s) + parseFloat(m)) / 2;
  return parseFloat(a);
}

function calculate_all() {
  total = 0;
  $$('.student').each( function(element) {
avg = calculate_average( element );
element.down('.average').value = avg;
total += avg;
  })
  console.log( ttl:  + total +  size:  + $$('.student').size() );
  $('total_average').value = total / $$('.student').size();
}

Hope its only a matter of using the right syntax to identify the DOM
elements im using.

On May 16, 12:38 am, Vladimir Tkach tea...@gmail.com wrote:
 Another one:
 $$('.filter').first().submit()

 --
 Best Regards,
 Vladimir Tkach

 +972-54-7574166
 tea...@gmail.com

 http://teamco-anthill.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---