PDA

View Full Version : Pop-it Menu Help



JamesRocks
10-14-2006, 12:25 AM
1) Script Title: Pop-It Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/popit.htm

3) Describe problem: Hi, I have edited this script so it fits in with my game, i have left every other part of the script alone, but I made a function up to get the "linksets" automatically, using a function called arrayits. The problem is, it works in Firefox, but it doesn't work in IE 6, but it works in IE7, here is the script that I edited:
http://www.seresel.com/functions.js

jscheuer1
10-14-2006, 07:14 AM
Are you getting any particular errors? I would need to see a call to arrayits() that didn't work to have a better idea. If the linkset array is ever looped through at any time, it would need to have consecutive values from whatever (usually 0) to whatever, valid for the loop. The parameter called id must be a number not a string (no quotes around it in the call to arrayits). Some of your URLs look a little suspect if they are to be rendered as HTML by the script, this shouldn't be a problem in IE 6 but might. If any of arrayits() parameters are also the id's or names of elements on your page, this often can cause problems in IE which often assumes document.all['id'] and document['name'] for variable names that are not formally declared using the var constructor and even sometimes for those that are.

This looks like it could be a problem:

(<color=blue>'+health+'</color>)

and using the & in a URL later rendered as HTML should be expressed as &amp; so that the browser doesn't try to resolve what follows it as a named or numbered entity.

JamesRocks
10-14-2006, 08:04 AM
I use arrayits() bound with my php, eg this:

<script>arrayits({$trueofo},\"".$assoc['name']."\",".$position['x'].",".$posy.",".$i.",false,false,".$assoc['id'].",'".$npc['name']."',".$npc['health'].")</script><img src=\"images/".$assoc['name'].".gif\" border=0 height=\"32\" width=\"32\" onMouseover=\"javascript:showmenu(event,linkset[".$i."])\" onMouseout=\"delayhidemenu()\">
It is pretty complicated, but it isn't actually for reading.. Ill see what taking out the health bit does. But on IE it splurts out the error:

'menuobj.style' is null or not an object, line 50,and line 84

jscheuer1
10-14-2006, 09:28 AM
One thing that you might try is changing:


clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
me . . .

to:


clearhidemenu()
menuobj=document.all? document.all['popitmenu'] : document.getElementById("popitmenu")
menuobj.innerHTML=which
me . . .

and make sure you have no other objects in your code or on your page with the name or id of popitmenu. IE is not case sensitive in these matters, although it should be, so Popitmenu could interfere with popItmenu or popitmenu, etc.

JamesRocks
10-14-2006, 09:57 AM
it still not working... thanks for trying anyway

jscheuer1
10-14-2006, 07:53 PM
I thought it would be worth a try. If I had a link to the problem page or a demo of it, I might be able to be of more help but, the use of PHP makes it hard to be certain. However, it looks to be a javascript error so - it should be traceable to at least the PHP output that is causing it. You also might want to check in the PHP forum - PHP is not one of my strong points.

JamesRocks
10-14-2006, 10:06 PM
It is fixed. I changed all occurances of "menuobj." with "document.getElementById("popitmenu").", now it works in all browsers ^__^

jscheuer1
10-15-2006, 02:59 AM
No it doesn't but, it should work in most modern browsers.