- Create Account

works only if I added alert

Forums > HTMLHttpRequest > works only if I added alert
Author
Message

1) zlizli Group: Members
Posts: 3 Joined: 29 Apr 2008 Location: IP: 70.21.--.--
Hi, Angus,

Thanks for the great script. I am using the "loadinto" feature to load another web page into an area of a web page. It worked in one setting which is within a wiki that uses smarty. However, in another setting which is simple php/html file, I can only get the second page to load into the designated area if I insert an "alert" statement in the "addEvent" section in the javascript section of the php/html file. Otherwise nothing happens after I click the link (no page is loaded). Furthermore, I noticed that the "addEvent" was called twice when I clicked the link once (two alerts).

I  am using the 1.0beta version of htmlhttprequest.html and accompanying js.

Thanks a lot for your help.

Z

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
Does the demonstration file work OK on my website for you?

It might be a strange interaction with another script...? Do you have a link to the page in question?

- Angus.

3) zlizli Group: Members
Posts: 3 Joined: 29 Apr 2008 Location: IP: 68.37.--.--
Yes, the demo works fine. You are correct! I do have another js script in the same html document. After I took that out, yours worked fine. That script is doing mouse-over menu thing. It uses addEventListener as well but only for "mouseover". I don't know whether it might interfere with your script. Unfortunately the page is still under development so I don't have one to the public. However, that script for mouseover is an open-source script named mm_menu.js. I can send it to you if I can have your email address.

Thanks  again for your help.

Z

4) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.173.--.--
Try reversing the order of the scripts with this one last.

- Angus.

5) zlizli Group: Members
Posts: 3 Joined: 29 Apr 2008 Location: IP: 70.21.--.--
Thanks, Angus. I did that but it did not help. However, I dug into the mm-menu.js code and found that the problem was with a line "if (document.captureEvents) document.captureEvents(Event.MOUSEUP);". If I commented out that line, everything works fine so far. I googled about document.captureEvents and got the impression that it was needed only for Netscape 4. I am not a javascript expert. Is it true? If it is, then I can live with that line commented out.

Thanks,

Z

6) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
It is rather old school yes :). I suspect that, if you don't care about NS4 compatibility, you can just leave it out!

Firefox technically still implements parts of the old NS4 event spec in places, this could be one of those weird issues.

- Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.