Hi folks. I''m getting an error here: $("imageShow1") has no properties $(''imageShow1'').update(''Fred''); Not too sure what that means. I can get an alert to work in its place just fine, so it''s being called properly from my Event.observe. So the issue comes with the element.update. The div is there: <div id="imageShow1"></div> And it''s inside a table cell, but I don''t think that means anything. Event.observe(''iframe1'', ''load'', showPic()); function showPic() { alert(''imageShow1''); $(''imageShow1'').update(''Fred''); So the trigger is working, the event.observe is working, and the function is being called, but the $(''imageShow1'').update(''Fred''); isn''t taking. Any ideas? Cheers --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
parry.luke-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Jul-09 14:58 UTC
Re: element.update error...no properties?
Hey there, one thing I would like to ask is that you have as the observed element as ''iframe1'', to clarify this isn''t an iframe right, which might cause problems. The alert works because it is simply a string, and doesn''t return an object, so you need to use alert($(imageShow1)); if it cannot find it may be because your script is located before the element, and the script needs placing further down your document, so it can use these elements Mr Parry. On Jul 8, 9:39 pm, BeeRich <beer...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi folks. > > I''m getting an error here: > > $("imageShow1") has no properties > $(''imageShow1'').update(''Fred''); > > Not too sure what that means. I can get an alert to work in its place > just fine, so it''s being called properly from my Event.observe. > > So the issue comes with the element.update. The div is there: > > <div id="imageShow1"></div> > > And it''s inside a table cell, but I don''t think that means anything. > > Event.observe(''iframe1'', ''load'', showPic()); > > function showPic() { > alert(''imageShow1''); > $(''imageShow1'').update(''Fred''); > > So the trigger is working, the event.observe is working, and the > function is being called, but the $(''imageShow1'').update(''Fred''); > isn''t taking. > > Any ideas? > > Cheers--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s it! On Jul 9, 2007, at 8:58 AM, parry.luke-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org wrote:> > Hey there, one thing I would like to ask is that you have as the > observed element as ''iframe1'', to clarify this isn''t an iframe right, > which might cause problems. > > The alert works because it is simply a string, and doesn''t return an > object, so you need to use alert($(imageShow1)); > > if it cannot find it may be because your script is located before the > element, and the script needs placing further down your document, so > it can use these elements > > Mr Parry. > > On Jul 8, 9:39 pm, BeeRich <beer...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi folks. >> >> I''m getting an error here: >> >> $("imageShow1") has no properties >> $(''imageShow1'').update(''Fred''); >> >> Not too sure what that means. I can get an alert to work in its >> place >> just fine, so it''s being called properly from my Event.observe. >> >> So the issue comes with the element.update. The div is there: >> >> <div id="imageShow1"></div> >> >> And it''s inside a table cell, but I don''t think that means anything. >> >> Event.observe(''iframe1'', ''load'', showPic()); >> >> function showPic() { >> alert(''imageShow1''); >> $(''imageShow1'').update(''Fred''); >> >> So the trigger is working, the event.observe is working, and the >> function is being called, but the $(''imageShow1'').update(''Fred''); >> isn''t taking. >> >> Any ideas? >> >> Cheers > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jul 9, 10:58 am, "parry.l...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org" <parry.l...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hey there, one thing I would like to ask is that you have as the > observed element as ''iframe1'', to clarify this isn''t an iframe right, > which might cause problems.Sorry, my ISP is up and down like a bus station toilet seat today. I will post the current test file I''ve made up, which replicates what I did in ... an earlier test: <script language="Javascript" type="text/javascript"> Event.observe(''iframe1'', ''load'', changediv ()); function changediv () { // alert(''OK SHE IS WORKING''); $(''imageShow1'').update(''OK SHE IS WORKING''); } </script> <iframe src="filler.html" id="iframe1" name="iframe1" target="iframe1" enctype="multipart/form-data" frameborder="2"> Sorry, your browser does not support this technology...please use Safari or Firefox </iframe> <a href="#" onclick="javascript:changediv(); return false;">CHANGE DIV</a><br/><br/> <div id="imageShow1">down here</div>> The alert works because it is simply a string, and doesn''t return an > object, so you need to use alert($(imageShow1)); > > if it cannot find it may be because your script is located before the > element, and the script needs placing further down your document, so > it can use these elementsOK, I moved the script below the target div, and she worked! Can you explain that one to me again? The elements in question have to be "declared" in the normal html BEFORE the JS can make functions operable? Is this correct? If so, is this theoretically backwards to what middleware devs would usually expect? It worked on my other example too. So that is it. Many thanks, but could you inform me as to why this needs to be lower than the elements? Cheers --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It''s like referencing a variable. Until the div, the variable is not available so the function is looking for a variable that does not exist In lasso land like using $ before the variable is created. Deco On Jul 9, 2007, at 10:39 AM, BeeRich wrote:> > > > On Jul 9, 10:58 am, "parry.l...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org" > <parry.l...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> Hey there, one thing I would like to ask is that you have as the >> observed element as ''iframe1'', to clarify this isn''t an iframe >> right, >> which might cause problems. > > Sorry, my ISP is up and down like a bus station toilet seat today. > > I will post the current test file I''ve made up, which replicates what > I did in ... an earlier test: > > <script language="Javascript" type="text/javascript"> > > Event.observe(''iframe1'', ''load'', changediv ()); > > function changediv () { > // alert(''OK SHE IS WORKING''); > $(''imageShow1'').update(''OK SHE IS WORKING''); > } > > </script> > > <safety: IFRAME tag removed> > enctype="multipart/form-data" frameborder="2"> > Sorry, your browser does not support this technology...please use > Safari or Firefox > </iframe> > > <a href="#" onclick="javascript:changediv(); return false;">CHANGE > DIV</a><br/><br/> > > <div id="imageShow1">down here</div> > > >> The alert works because it is simply a string, and doesn''t return an >> object, so you need to use alert($(imageShow1)); >> >> if it cannot find it may be because your script is located before the >> element, and the script needs placing further down your document, so >> it can use these elements > > OK, I moved the script below the target div, and she worked! Can you > explain that one to me again? The elements in question have to be > "declared" in the normal html BEFORE the JS can make functions > operable? Is this correct? If so, is this theoretically backwards to > what middleware devs would usually expect? > > It worked on my other example too. So that is it. Many thanks, but > could you inform me as to why this needs to be lower than the > elements? > > Cheers > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jul 9, 2007, at 12:39 PM, BeeRich wrote:> OK, I moved the script below the target div, and she worked! Can you > explain that one to me again? The elements in question have to be > "declared" in the normal html BEFORE the JS can make functions > operable? Is this correct? If so, is this theoretically backwards to > what middleware devs would usually expect?This is expected behavior. If you want to declare things first, then wrap them inside a page-level observer, like this: function changediv() ... } Event.observe(window,''load'',function(){ Event.observe(''iframe'',''load'',''changediv''); }); The function won''t fire until the entire window is loaded, thus satisfying your required elements in order for $(''imageShow1'') to actually exist. Walter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 7/9/07, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> This is expected behavior. If you want to declare things first, then > wrap them inside a page-level observer, like this: > > function changediv() > ... > } > > Event.observe(window,''load'',function(){ > Event.observe(''iframe'',''load'',''changediv''); > }); > > The function won''t fire until the entire window is loaded, thus > satisfying your required elements in order for $(''imageShow1'') to > actually exist.Ah ok, I was under the impression the iFrame could have already been loaded, so the "watch this thing coming up" would have had to have been beforehand. Good to know. So close yet so far. Cheers -- BeeRich, Toronto --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jul 9, 2007, at 12:58 PM, BeeRich wrote:> > On 7/9/07, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: > >> >> The function won''t fire until the entire window is loaded, thus >> satisfying your required elements in order for $(''imageShow1'') to >> actually exist. > > Ah ok, I was under the impression the iFrame could have already been > loaded, so the "watch this thing coming up" would have had to have > been beforehand.Further to this, if you are trying to observe something that is itself loading within an iFrame, that might be a big problem. The iFrame is like cutting a hole in your site and loading another site through it -- I don''t believe your page gets notified in any way if / when the content loads or updates within that iFrame. I stand to be educated on that point, though. Walter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jul 9, 1:05 pm, Walter Lee Davis <w...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> Further to this, if you are trying to observe something that is itself > loading within an iFrame, that might be a big problem. The iFrame is > like cutting a hole in your site and loading another site through it -- > I don''t believe your page gets notified in any way if / when the > content loads or updates within that iFrame. > > I stand to be educated on that point, though.Hi Walter. I originally moved my perspective out of the iFrame for that very reason. Nothing was working. So I moved to an event.observe in order to have the iFrame load, be the trip for this whole process. So you are right, the hole''s contents doesn''t see the rim of the hole in any way. Divs aren''t declared, as this thread suggests. Now I have another issue. After the first div update/replace, Prototype 1.5.1.1 has an error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://127.0.0.1/localtest/master_includes/prototype1511.js :: anonymous :: line 3005" data: no] Not sure what to do there. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Now I have another issue. After the first div update/replace, > Prototype 1.5.1.1 has an error: > > uncaught exception: [Exception... "Could not convert JavaScript > argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" > location: "JS frame ::http://127.0.0.1/localtest/master_includes/prototype1511.js > :: anonymous :: line 3005" data: no] > > Not sure what to do there.Actually it''s behaving differnetly in both Safari (where it works) and Firefox, where the first alert notifies me, then it trips that posted error. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---