[FX.php List] JavaScript, AJAX, jQuery assistance?

Joel Shapiro jsfmp at earthlink.net
Wed Sep 26 11:57:37 MDT 2007


Hi Steve

Thanks so much.  Alex Gates had sent me that same solution back-channel.

However....

At least in Safari, once the AJAX div is loaded, hovering over the  
original tooltip link displays that tooltip PLUS another partial  
tooltip below the grey 'info' div... and that tooltip never hides  
again even when the mouse is off the link.

I'll check into prototype and see if that'll help me through this.

Thanks all for your help.  (I'll be out all today but back on it when  
I get the stomach for it ;)

-Joel


On Sep 26, 2007, at 12:24 AM, Steve Winter wrote:

> Hi Joel,
>
> My solution to this is to change your load function in the main  
> page to call
> the JT_int() after the content has been written into the getDiv, so it
> becomes;
>
>   function load() {
>     if(LAJAX.state() == 4) {
> 	document.getElementById('getDIV').innerHTML=LAJAX.result();
> 	JT_init();
>     } else {
> 	document.getElementById('getDIV').innerHTML=".. " + LAJAX.state();
>     }	
>   }
>
> And then all seems to work, see
> http://clients.matatirosolutions.co.uk/fmpdemo/joel/ for a working
> version...
>
> For what it's worth, it doesn't appear that it's possible to include
> javascript within the page called by LAJAX because of the way in  
> which that
> content is written into the div (ie the script above). I've found  
> the ajax
> functions provided by prototype.js (see http:// 
> www.prototypejs.org/) to be
> extremely easy to use, to function extremely well, and you can  
> explicitly
> allow or deny the running of scripts within loaded files during the  
> call to
> that file...
>
> Cheers
> Steve
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Alex Gates
> Sent: Wednesday, 26 September 2007 1:09 a.m.
> To: FX.php Discussion List
> Subject: Re: [FX.php List] JavaScript, AJAX, jQuery assistance?
>
> Joel -
>
> I'm over here trying to figure it out too... I couldn't get the <body
> onload="JT_init();"> to do anything - nor could I get a
> <script type='text/javascript'>
>    window.onload="JT_init()";
>   </script>
> after </body>
> to do anything...
>
> but I COULD get
> <a href="text.html" name="Caption here" id="2" class="jTip"
> onmouseover="JT_init();">I want a tooltip to show when hovering  
> here but
> it seems that it's not reading the already loaded jtip.js</a>
>
> to do what you want... BUT... (always a but, of course) not on the
> INITIAL mouseover... but the tooltip shows up on the second mouseover.
>
> So - that answers the question... you just need to find a way to fire
> that JT_init();
>
> Keep me posted!  Sorry I'm such a Javascript noob!
>
>
> Joel Shapiro wrote:
>> Hey Nick
>>
>> This sounds so good.... but I'm blanking out here.
>>
>> What would the script block look like?  I tried:
>>
>> <script type='text/javascript'>
>>     JT_init();
>> </script>
>>
>> after the </div> on ajaxpage.html
>>
>> I also tried making ajaxpage.html a full html page and putting an  
>> onload
>> call to JT_init(); in the body element.
>>
>> (And... I don't know how to run something in firebug that's not in  
>> the
>> original page :-P  )
>>
>> Thanks,
>> -Joel
>>
>>
>> On Sep 25, 2007, at 3:57 PM, Nick wrote:
>>
>>> well I can tell you that it doesn't work because you haven't  
>>> attached
>>> an event to that link.
>>>
>>> the way jTip seems to work is that when the page initially loads, it
>>> calls JT_init();
>>> which attaches events to all current a links that have class of jTip
>>> the div you load later never gets touched by JT_init().
>>>
>>> try running JT_init(); in a script block at the end of your
>>> ajaxpage.html, or onsuccess of loading.  though this isn't the ideal
>>> solution, you will see that it works.
>>>
>>> you can also run JT_init(); in the firebug console after loading the
>>> div, and then hover and see that it works.
>>>
>>> On 9/25/07, Joel Shapiro < jsfmp at earthlink.net> wrote:Hmm is right!
>>>
>>> Another weird thing: I used Firefox's Web Developer to View  
>>> Generated
>>> Source after loading the AJAX div.  I copied the generated source  
>>> and
>>> pasted it into a new page, and the tooltip *does* work in the
>>> (yellow) div -- until I refresh the div with the AJAX call, and then
>>> it behaves as originally -- not working.
>>>
>>> <sigh>
>>>
>>> -Joel
>>>
>>>
>>> On Sep 25, 2007, at 11:26 AM, Dale Bengston wrote:
>>>
>>>> Hey Joel,
>>>>
>>>> No, I didn't mean to imply uppers were better than lowers. I had to
>>>> write them in some order or other!
>>>>
>>>> Looking at your page with FireBug and FireFox, the part that gets
>>>> AJAX-d in doesn't even fire off an event when you roll over it. It
>>>> doesn't generate any errors either. Hmm.
>>>>
>>>> Dale
>>>>
>>>> On Sep 25, 2007, at 1:21 PM, Joel Shapiro wrote:
>>>>
>>>>> Thanks Dale & Nick for the suggestions -- and the advice to always
>>>>> start element names with letters.  (Dale, were you implying that
>>>>> starting them with CAPS are preferable to lower case "Try starting
>>>>> them with A-Z, a-z"?)
>>>>>
>>>>> I haven't found a fix yet...  I'll keep trying.
>>>>>
>>>>> Any other suggestions?
>>>>>
>>>>> Thanks,
>>>>> -Joel
>>>>>
>>>>>
>>>>> On Sep 24, 2007, at 9:34 PM, Nick wrote:
>>>>>
>>>>>> I noticed you're using a few different doctypes.  along with id's
>>>>>> starting with letters and not numbers as said above, checking
>>>>>> which doctypes your javascript supports is a good idea.
>>>>>
>>>>>
>>>>> On Sep 24, 2007, at 7:34 PM, Dale Bengston wrote:
>>>>>
>>>>>> Hi Joel,
>>>>>>
>>>>>> What happens if you use double quotes around the id of the ajax-d
>>>>>> div instead of single quotes? Also, JavaScript doesn't like
>>>>>> element names and other attributes that start with numbers (form
>>>>>> names, classes, ids, etc.) Try starting them with A-Z, a-z.
>>>>>>
>>>>>> Hope this gets you started,
>>>>>>
>>>>>> Dale
>>>>>>
>>>>>> On Sep 24, 2007, at 7:50 PM, Joel Shapiro wrote:
>>>>>>
>>>>>>> Hi all
>>>>>>>
>>>>>>> I've got a JavaScript tooltip (jTip with jQuery) working to pull
>>>>>>> record details (not initially loaded on the page) into a
>>>>>>> tooltip.  This works fine.
>>>>>>>
>>>>>>> I've also got links that load new data into existing divs on my
>>>>>>> starting page.  This also works fine.
>>>>>>>
>>>>>>> However...
>>>>>>> I would like the reloaded divs to still have 'hover-able'
>>>>>>> tooltips... but this is not working fine.  It's not working at
>>>>>>> all :-(
>>>>>>>
>>>>>>> It _seems_ that the reloaded divs can't refer back to the
>>>>>>> tooltip JavaScript that was loaded when the start page first
>>>>>>> loaded.  Yet when I try a different js tooltip, I *can* get the
>>>>>>> tooltips to work inside the new AJAX divs.
>>>>>>>
>>>>>>> I've put a demo here:
>>>>>>> http://jsfmp.com/tooltip/notworking.html
>>>>>>>
>>>>>>> (This is not connected to a DB, although I'm using LAJAX to call
>>>>>>> the ajaxpage into the div because it was available and easy ;)
>>>>>>>
>>>>>>>  - So my question is:  Why is the jQuery/jTip tooltip not
>>>>>>> working while another js tooltip is?  And is there anything I
>>>>>>> can do so that the jTip functionality will work inside the
>>>>>>> reloaded AJAX divs?  (The tooltip that *does* work doesn't have
>>>>>>> features I'd like to use, such as re-positioning so tooltips
>>>>>>> don't go outside the browser window...)
>>>>>>>
>>>>>>> Thanks for any/all suggestions.
>>>>>>>
>>>>>>> -Joel
>>>>>>> _______________________________________________
>>>>>>> FX.php_List mailing list
>>>>>>> FX.php_List at mail.iviking.org
>>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>
>>>>>> _______________________________________________
>>>>>> FX.php_List mailing list
>>>>>> FX.php_List at mail.iviking.org
>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>
>>>>> _______________________________________________
>>>>> FX.php_List mailing list
>>>>> FX.php_List at mail.iviking.org
>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.13.30/1029 - Release Date:  
> 24/09/2007
> 7:09 p.m.
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.13.30/1029 - Release Date:  
> 24/09/2007
> 7:09 p.m.
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list