Hi All,
I am writing sample programs using Prototype to better understand its
various classes and their methods and properties.
However, I got the following two questions -
1. alert($("divid").innerText) - This works fine only in IE but not
in
Firefox.
alert($("divid").innerHTML) - This works fine in both IE and
Firefox.
Why Firefox is not able to bring the text that is present inside a div
tag using "innerText". Because at every instance there may not be
requirement to get inner HTML from an div element.
2. This is regarding PeriodicalUpdater method -
I have written the following code which will increment the value
present in the div tag with 1 every time it is called. But it is not
doing so.
function PeriodicUpdater()
{
var myajax = new
Ajax.PeriodicalUpdater("counter","http://testserver/phanites.nsf/AJAXAgent?OpenAgent&rndtext="
+ $("counter").innerHTML+ "",
{
onFailure: function(request) {alert("Error");},
frequency : 4,
decay : 2
}
);
}
where counter is a div tag defined as - <div
id="counter">0</div>
This Ajax code calls the Lotus Domino agent with the counter (div tag
above) as the parameter.
For the first time, the value for "counter" gets to 1. But after that
it remains 1 for ever and the parameter passed to the URL is again 0.
Could you help me out in understanding what went wrong in my sample
code.
Thanks,
--Phani
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Phani wrote:> 1. alert($("divid").innerText) - This works fine only in IE but not in > Firefox. > alert($("divid").innerHTML) - This works fine in both IE and > Firefox. > > Why Firefox is not able to bring the text that is present inside a div > tag using "innerText"."Firefox" doesn''t provide a "innerText" attribute for elements. "textContent" is the most similar attribute that you could use on Gecko apps, but keep in mind it doesn''t have exactly the same effect as IE''s "innerText".> 2. This is regarding PeriodicalUpdater method - > I have written the following code which will increment the value > present in the div tag with 1 every time it is called. But it is not > doing so. > > function PeriodicUpdater() > { > var myajax = new > Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=" > + $("counter").innerHTML+ "", [...] > where counter is a div tag defined as - <div id="counter">0</div>$("counter").innerHTML is evaled at Ajax.PeriodicalUpdater''s instantiation time. In other words, your call is exactly the same as: var myajax = new Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=0", [...] OK, where are those Prototype related questions? ;-) happy etc ;-) - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFFkWVJtZHp/AYZiNkRAqlpAJ0UsyKkLpcZ5bhiaUxPv5ngmj6NPwCgxBjk P69looPpi6QYv9Fbo/Z7Dvk=8v3u -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phani wrote:> Hi All, > > I am writing sample programs using Prototype to better understand its > various classes and their methods and properties. > > However, I got the following two questions - > > 1. alert($("divid").innerText) - This works fine only in IE but not in > Firefox.innerText is a Microsoft proprietary property, it is supported by IE and few other others but not Gecko based browsers (such as Firefox and Mozilla). The W3C equivalent is textContent.> alert($("divid").innerHTML) - This works fine in both IE and > Firefox.innerHTML is another Microsoft proprietary property, it has been more widely copied than innerText.> > Why Firefox is not able to bring the text that is present inside a div > tag using "innerText". Because at every instance there may not be > requirement to get inner HTML from an div element.Test for textContent and if that fails try innerText. Or use a cross browser solution such as get the innerHTML and strip the mark-up tags with a regular expression, or walk down the DOM and collect the values of all the text nodes. -- Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks guys on innerText part.
Marius I should have been more specific in my subject ;) ... changed it
now.
I understand what you have written below is same as getting value using
$("counter").innerHTML
> var myajax = new
>
Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=0",
[...]
But, my question is how to increment it. I want to increment the value
in "counter" element by 1 every time this updater runs....
--Phani
On Dec 26, 11:09 pm, Marius Feraru <altb...-9gptZ63fvgw@public.gmane.org>
wrote:> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Phani wrote:
> > 1. alert($("divid").innerText) - This works fine only in IE
but not in
> > Firefox.
> > alert($("divid").innerHTML) - This works fine in both IE
and
> > Firefox.
>
> > Why Firefox is not able to bring the text that is present inside a div
> > tag using "innerText"."Firefox" doesn''t
provide a "innerText" attribute for elements.
> "textContent" is the most similar attribute that you could use on
Gecko
> apps, but keep in mind it doesn''t have exactly the same effect as
IE''s
> "innerText".
>
> > 2. This is regarding PeriodicalUpdater method -
> > I have written the following code which will increment the value
> > present in the div tag with 1 every time it is called. But it is not
> > doing so.
>
> > function PeriodicUpdater()
> > {
> > var myajax = new
> >
Ajax.PeriodicalUpdater("counter","http://[...]&rndtext="
> > + $("counter").innerHTML+ "", [...]
> > where counter is a div tag defined as - <div
id="counter">0</div>$("counter").innerHTML is
evaled at Ajax.PeriodicalUpdater''s
> instantiation time. In other words, your call is exactly the same as:
>
> var myajax = new
>
Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=0",
[...]
>
> OK, where are those Prototype related questions? ;-)
>
> happy etc ;-)
> - --
> Marius Feraru
> -----BEGIN PGP SIGNATURE-----
>
> iD8DBQFFkWVJtZHp/AYZiNkRAqlpAJ0UsyKkLpcZ5bhiaUxPv5ngmj6NPwCgxBjk
> P69looPpi6QYv9Fbo/Z7Dvk> =8v3u
> -----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Hi, sorry I''m joining this discussion a little late, but still- Phani, you can take a block of HTML and get only it''s prevalent text by stripping HTML tags, as already said by Fred> a cross browser solution such as get the innerHTML and strip the mark-up tags > with a regular expression, or walk down the DOM and collect the values > of all the text nodes.Thought I''d help you out with that - say x= $(''someDiv'').innerHTML; then var y = x.replace(/(<([^>]+)>)/ig,""); should return you "innerText", or just the text content prevalent in that div. Yeah? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Phani wrote:> I understand what you have written below is same as getting value using > $("counter").innerHTML > >> var myajax = new >> Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=0", [...] > > But, my question is how to increment it. I want to increment the value > in "counter" element by 1 every time this updater runs....OK, I guess you mean "how to change rndtext''s value after each update?" Use "onSuccess" option to bind a function that will do that. Here is an example: function PeriodicUpdater() { var cnt = $(''counter''); cnt._updater = new Ajax.PeriodicalUpdater( cnt, ''http://testserver/phanites.nsf/AJAXAgent'', { frequency: 4, decay: 2, parameters: { OpenAgent: '''', rndtext: parseInt(cnt.innerHTML) || 0 }, onFailure: function(xhr) { alert("Error"); }, onSuccess: function () { this._updater.options.parameters.rndtext++; }.bind(cnt) } ); } cheers - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFFkhgTtZHp/AYZiNkRAtmtAKCmla+KDbOlnDUaVmPYU/O+nQTu5ACeKYH+ H3ZTGnOToQo2d+6OnUYTI9I=+oiI -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sunil,
Thankyou, I will test your below code.
But on the other hand I found a pretty good function inbuilt in
Prototype i.e stripTags()
I used the above method like this -
Created a sample div tag like this -
<div id="strip"><b>bold</b> text here</div>
Then button -
<input type=button name="b7" value="strip"
onClick="strip()">
function strip()
{
var withouthtml = $("strip1").innerHTML;
alert(withouthtml);
alert(withouthtml.stripTags());
}
That''s it.. This method will strip out all the HTML and XML tags from
the string.
HTH
--Phani
On Dec 27, 11:31 am, "Pi"
<threepoint...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi, sorry I''m joining this discussion a little late, but still-
>
> Phani, you can take a block of HTML and get only it''s prevalent
text by
> stripping HTML tags, as already said by Fred
>
> > a cross browser solution such as get the innerHTML and strip the
mark-up tags
> > with a regular expression, or walk down the DOM and collect the values
> > of all the text nodes.Thought I''d help you out with that -
say
> x= $(''someDiv'').innerHTML;
> then
> var y = x.replace(/(<([^>]+)>)/ig,"");
>
> should return you "innerText", or just the text content prevalent
in
> that div.
>
> Yeah?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Marius, I have already tried using parameters option, but it doesn''t seem to work with PeriodicalUpdater both in IE and Firefox. Also, I used the below code in my program and it doesn''t seem to trigger at all in IE but working in Firefox. As said earlier, the parameter is not at all passed to the url. I will try to figure out your code as it is new for me, especially the "_updater" lines - cnt._updater = new Ajax.PeriodicalUpdater( and this._updater.options.parameters.rndtext++; Thanks once again for your help. --Phani On Dec 27, 11:52 am, Marius Feraru <altb...-9gptZ63fvgw@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Phani wrote: > > I understand what you have written below is same as getting value using > > $("counter").innerHTML > > >> var myajax = new > >> Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=0", [...] > > > But, my question is how to increment it. I want to increment the value > > in "counter" element by 1 every time this updater runs....OK, I guess you mean "how to change rndtext''s value after each update?" > > Use "onSuccess" option to bind a function that will do that. > Here is an example: > > function PeriodicUpdater() { > var cnt = $(''counter''); > cnt._updater = new Ajax.PeriodicalUpdater( > cnt, > ''http://testserver/phanites.nsf/AJAXAgent'', > { > frequency: 4, > decay: 2, > parameters: { > OpenAgent: '''', > rndtext: parseInt(cnt.innerHTML) || 0 > }, > onFailure: function(xhr) { alert("Error"); }, > onSuccess: function () { > this._updater.options.parameters.rndtext++; > }.bind(cnt) > } > ); > > }cheers > - -- > Marius Feraru > -----BEGIN PGP SIGNATURE----- > > iD8DBQFFkhgTtZHp/AYZiNkRAtmtAKCmla+KDbOlnDUaVmPYU/O+nQTu5ACeKYH+ > H3ZTGnOToQo2d+6OnUYTI9I> =+oiI > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Phani wrote:> I have already tried using parameters option, but it doesn''t seem to > work with PeriodicalUpdater both in IE and Firefox. > Also, I used the below code in my program and it doesn''t seem to > trigger at all in IE but working in Firefox.Are you _sure_ you use a fresh enough version of Prototype? Current revision is 5794. - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFFkivWtZHp/AYZiNkRAslqAKCcC20cnnAM+Q4RujX861B9Lm1EpwCfYOEi h9KJptkaiKlhq/XuiQWSweo=7Xum -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes. Got the latest version from the below link - http://dev.rubyonrails.org/browser/trunk/railties/html/javascripts/prototype.js?format=txt but still no luck. --Phani On Dec 27, 1:16 pm, Marius Feraru <altb...-9gptZ63fvgw@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Phani wrote: > > I have already tried using parameters option, but it doesn''t seem to > > work with PeriodicalUpdater both in IE and Firefox. > > Also, I used the below code in my program and it doesn''t seem to > > trigger at all in IE but working in Firefox.Are you _sure_ you use a fresh enough version of Prototype? > Current revision is 5794. > > - -- > Marius Feraru > -----BEGIN PGP SIGNATURE----- > > iD8DBQFFkivWtZHp/AYZiNkRAslqAKCcC20cnnAM+Q4RujX861B9Lm1EpwCfYOEi > h9KJptkaiKlhq/XuiQWSweo> =7Xum > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Phani wrote:> Yes. > Got the latest version from the below link - > http://dev.rubyonrails.org/browser/trunk/railties/html/javascripts/prototype.js?format=txt > but still no luck.OK, now I''m pissed off, breast feeding it''s not my job :-( Here''s a dumbed example where it WORKS: http://www.neohub.com/tmp.bak/ Tested with: 1) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322) 2) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061222 Firefox/2.0.0.1 3) Opera/9.10 (X11; Linux i686; U; en) 4) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061110 Fedora/1.0.6-2.fc7 SeaMonkey/1.0.6 Mnenhy/0.7.4.666 5) Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) enough already? :( - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFFkkb7tZHp/AYZiNkRAjdwAJ0SmYp1F1w3ScUz+7ZUflkz9Q1x9wCfZ7F8 YmDOD0AQQz1PT1PkCv51eYo=Jg6U -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you. And sorry to bother you. --Phani On Dec 27, 3:12 pm, Marius Feraru <altb...-9gptZ63fvgw@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Phani wrote: > > Yes. > > Got the latest version from the below link - > >http://dev.rubyonrails.org/browser/trunk/railties/html/javascripts/pr... > > but still no luck.OK, now I''m pissed off, breast feeding it''s not my job :-( > > Here''s a dumbed example where it WORKS:http://www.neohub.com/tmp.bak/ > > Tested with: > 1) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; > .NET CLR 1.1.4322) > 2) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061222 > Firefox/2.0.0.1 > 3) Opera/9.10 (X11; Linux i686; U; en) > 4) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061110 > Fedora/1.0.6-2.fc7 SeaMonkey/1.0.6 Mnenhy/0.7.4.666 > 5) Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) > Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) > > enough already? :( > - -- > Marius Feraru > -----BEGIN PGP SIGNATURE----- > > iD8DBQFFkkb7tZHp/AYZiNkRAjdwAJ0SmYp1F1w3ScUz+7ZUflkz9Q1x9wCfZ7F8 > YmDOD0AQQz1PT1PkCv51eYo> =Jg6U > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Try this... :D
function PeriodicUpdater() {
var myajax = new Ajax.PeriodicalUpdater(
"counter",
"http://testserver/phanites.nsf/AJAXAgent"
("counter").innerHTML+ "",
{
method: ''get'',
parameters: "?OpenAgent&rndtext=" +
parseInt($("counter").innerHTML),
onFailure: function(request) {alert("Error");},
onComplete: function(request,json) {
this.options.parameters = "?OpenAgent&rndtext=" +
parseInt($(''counter'').innerHTML);
}.bind(myajax),
frequency : 4,
decay : 2
}
);
}
Bind your Ajax.PeriodicalUpdater object to your onComplete function
and then you can have it update the request parameters each time a
request is completed successfully.
That should do the trick for your original question about the updater.
As to the .innerHTML vs. .innerText argument, know that both
.innerHTML and .innerText are not a part of the standard. Originally,
Microsoft invented both the .innerHTML and .innerText properties, as
well as the .outerHTML and .outerText properties. Most modern browsers
liked the swift functionality that IE was providing with .innerHTML
and replicated it, however it still has not yet made it into the
standard. However, some studies
[http://www.quirksmode.org/dom/innerhtml.html] have shown that
.innerHTML is many times faster than using native DOM mechanisms, and
since .innerHTML is easy and supported by the top3 browsers
(IE,Mozilla, and Opera) it is generally accepted to be a good practice
to use it.
However, IE is still the only one (as far as I know) using
.innerText,.outerText, and .outerHTML so if you are interested in
cross-browser functionality, you''d best avoid those variables. Since
you are using Prototype.js, there are some cross-browser mechanisms to
provide functionality to all browsers that IE is providing natively.
Look at some of the documentation available online to combine a few
tricks to get that functionality.
[http://www.sergiopereira.com/articles/prototype.js.html,
http://wiki.script.aculo.us/scriptaculous/show/Prototype]
Hope this helps.
-E
(Forgive me if my code example doesn''t work perfectly. It works in
theory, so minor tweaks should make it work perfectly for you if it
doesn''t work right away. Basically just make sure your onComplete
function has the whole object available to it so that you can
manipulate the options.parameters value)
On 12/26/06, Fred <ozfred-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org>
wrote:>
>
> Phani wrote:
> > Hi All,
> >
> > I am writing sample programs using Prototype to better understand its
> > various classes and their methods and properties.
> >
> > However, I got the following two questions -
> >
> > 1. alert($("divid").innerText) - This works fine only in IE
but not in
> > Firefox.
>
> innerText is a Microsoft proprietary property, it is supported by IE
> and few other others but not Gecko based browsers (such as Firefox and
> Mozilla). The W3C equivalent is textContent.
>
>
> > alert($("divid").innerHTML) - This works fine in both IE
and
> > Firefox.
>
> innerHTML is another Microsoft proprietary property, it has been more
> widely copied than innerText.
>
> >
> > Why Firefox is not able to bring the text that is present inside a div
> > tag using "innerText". Because at every instance there may
not be
> > requirement to get inner HTML from an div element.
>
> Test for textContent and if that fails try innerText. Or use a cross
> browser solution such as get the innerHTML and strip the mark-up tags
> with a regular expression, or walk down the DOM and collect the values
> of all the text nodes.
>
>
> --
> Fred
>
>
> >
>
--
Eric Ryan Harrison
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Ahh, I posted the same sort of thing to your original thread and hadn''t read this one yet to see that you had already gotten a good response here. Sorry, -E On 12/27/06, Phani <phanikirankumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thank you. And sorry to bother you. > > --Phani > > On Dec 27, 3:12 pm, Marius Feraru <altb...-9gptZ63fvgw@public.gmane.org> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Phani wrote: > > > Yes. > > > Got the latest version from the below link - > > >http://dev.rubyonrails.org/browser/trunk/railties/html/javascripts/pr... > > > but still no luck.OK, now I''m pissed off, breast feeding it''s not my job :-( > > > > Here''s a dumbed example where it WORKS:http://www.neohub.com/tmp.bak/ > > > > Tested with: > > 1) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; > > .NET CLR 1.1.4322) > > 2) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061222 > > Firefox/2.0.0.1 > > 3) Opera/9.10 (X11; Linux i686; U; en) > > 4) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061110 > > Fedora/1.0.6-2.fc7 SeaMonkey/1.0.6 Mnenhy/0.7.4.666 > > 5) Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) > > Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) > > > > enough already? :( > > - -- > > Marius Feraru > > -----BEGIN PGP SIGNATURE----- > > > > iD8DBQFFkkb7tZHp/AYZiNkRAjdwAJ0SmYp1F1w3ScUz+7ZUflkz9Q1x9wCfZ7F8 > > YmDOD0AQQz1PT1PkCv51eYo> > =Jg6U > > -----END PGP SIGNATURE----- > > > > >-- Eric Ryan Harrison --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric Harrison wrote:> var myajax = new Ajax.PeriodicalUpdater([...]> onComplete: function(request,json) { > > Bind your Ajax.PeriodicalUpdater object to your onComplete function > and then you can have it update the request parameters each time a > request is completed successfully."onComplete" has a different meaning in Ajax.PeriodicalUpdater''s context: it will be executed "on stop". - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFFkk1wtZHp/AYZiNkRAoheAKCc0K0HLV8xkpS2LzLTugAAMUoYFACgilFj CGsEX/ojRSqKbpZAntkdi3Q=wxhb -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Eric Harrison wrote:> Try this... :DYou have replied to the wrong post. If you reply below trimmed quotes of what you are replying to, not only will your reply make more sense, but also errors like replying to the wrong post should be obvious. -- Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maybe so... but at 5:30 AM I''m not really all that concerned with making sure my post is in the right place... I made the mistake of just using GMail''s reply box and not actually clicking the reply link in the post. Oh well... either way it doesn''t really matter anymore. -E On 12/27/06, Fred <ozfred-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org> wrote:> > > Eric Harrison wrote: > > Try this... :D > > You have replied to the wrong post. If you reply below trimmed quotes > of what you are replying to, not only will your reply make more sense, > but also errors like replying to the wrong post should be obvious. > > -- > Fred > > > > >-- Eric Ryan Harrison --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks Marius, Eric, Fred and Pi for helping me out. Finally made this to work. --Phani On Dec 27, 3:31 pm, "Eric Harrison" <blis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ahh, I posted the same sort of thing to your original thread and > hadn''t read this one yet to see that you had already gotten a good > response here. > > Sorry, > > -E > > On 12/27/06, Phani <phanikiranku...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Thank you. And sorry to bother you. > > > --Phani > > > On Dec 27, 3:12 pm, Marius Feraru <altb...-9gptZ63fvgw@public.gmane.org> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > Phani wrote: > > > > Yes. > > > > Got the latest version from the below link - > > > >http://dev.rubyonrails.org/browser/trunk/railties/html/javascripts/pr... > > > > but still no luck.OK, now I''m pissed off, breast feeding it''s not my job :-( > > > > Here''s a dumbed example where it WORKS:http://www.neohub.com/tmp.bak/ > > > > Tested with: > > > 1) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; > > > .NET CLR 1.1.4322) > > > 2) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061222 > > > Firefox/2.0.0.1 > > > 3) Opera/9.10 (X11; Linux i686; U; en) > > > 4) Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061110 > > > Fedora/1.0.6-2.fc7 SeaMonkey/1.0.6 Mnenhy/0.7.4.666 > > > 5) Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) > > > Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) > > > > enough already? :( > > > - -- > > > Marius Feraru > > > -----BEGIN PGP SIGNATURE----- > > > > iD8DBQFFkkb7tZHp/AYZiNkRAjdwAJ0SmYp1F1w3ScUz+7ZUflkz9Q1x9wCfZ7F8 > > > YmDOD0AQQz1PT1PkCv51eYo> > > =Jg6U > > > -----END PGP SIGNATURE------- > Eric Ryan Harrison- Hide quoted text -- Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---