In IE the page renders and operates fine but shows an error icon. The error is: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC1; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618) Timestamp: Sat, 19 Sep 2009 20:28:57 UTC Message: Object required Line: 109 Char: 26 Code: 0 URI: http://www.askmefast.com/ The first person to find the bug and post a fix including the exact edits necessary to fix it I will paypal $50 to. You may need to save a static copy of the HD to work with it and make sure your fix works. You must have tried and tested the fix to make sure it works. Thanks, Doug
around line 144 you have this: d1 = GetDistance("sp1"); d2 = GetDistance("sp2"); d3 = GetDistance("sp3"); Code (markup): there aren't any objects with the id "sp[1-3]" Try to remove it. I removed it and it worked fine. Or you can check whether the object exists like that: function GetDistance(objname) { var zonewidth=15; var sp=document.getElementById(objname); if(!sp) { var spx=getX(sp); var spy=getY(sp); var spw=getWidth(sp); var sph=getHeight(sp); var rx=tempX; var ry=tempY; if (tempX<spx-zonewidth) rx=spx-zonewidth; if (tempX>(spx+spw+zonewidth)) rx=spx+spw+zonewidth; if (tempY<spy-zonewidth) ry=spy-zonewidth; if (tempY>(spy+sph+zonewidth)) ry=spy+sph+zonewidth; return Math.floor(Math.sqrt(Math.pow((rx-tempX),2)+Math.pow((ry-tempY),2))); } } function getMouseXY(e) { if (IE) { // grab the x-y pos.s if browser is IE tempX = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); tempY = event.clientY +(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0} d1 = GetDistance("sp1"); d2 = GetDistance("sp2"); d3 = GetDistance("sp3"); //document.Show.msg.value="Rx:"+rx+" Ry:"+ry+" distance:"+distance; //document.Show.msg.value="Height: "+sph+" distance:"+distance; return true } Code (markup): (Replace the functions with the existing ones)
var sp=document.getElementById(objname); After the above line(108 line) just add if(!sp) return; it will solve your issue...
kishore415 got it! shizzie came so very close! But removing the lines you suggested breaks my code because it is needed. kishore415's code works perfect and does not break the rest of my code. I am paying $50 to kishore415. Thanks everyone!
oli3L: Yes what I said to shizzie actually applies to you. He just tested it. However, removing the code breaks other code I have. kishore415 gave me actual code and told me where to place it. I did and it worked. His code does not remove any code. It only skips the code when the variable is not defined yet. Thus fixing the problem without breaking any other code dependent on this code. It may have appeared to work for you but thats because the error it produces is not evident to the user but messes up the back end. Kishore415's solution works on both counts. Kudos to you for getting the idea, but kishore posted a working fix first. PS: Kishore415 please pm me your paypal id. Thanks to everyone, Doug
oli3L I have to apologize. I now see that you did post it first under a slightly different form: if(!sp) { ahhh! so very sorry. you did win. Please send me your paypal and I will pay you. Sorry kishore! but he really did post it first as you can see by inspecting the sample code he posted. Thanks, Doug
you are very wrong ... if(!sp){ blah....blah.. } the above code never works if(sp) { blah....blah.. } will work May be in a hurry he made a mistake even if he found the right solution What he is doing if it the sp value is null , it shudnot go inside and call other functions..but he is calling the functions only when sp null. You can test the function posted in the thread and confirm
with what i see, kishore415 deserves the payment. the reasons are.. 1 the earlier guy has the logic right, but it is very confusing with two ideas one f which is to remove some code. obviously the OP rejected that idea 2. The OP actually used the suggestion of kishore to solve his problem. so he deserved the credit, since he posted a clear no-nonsense solution. just my two cents Pepp
Oh boy! This is crazy. Looks like Kishore did win although Oli3L came up with the idea first but wrote it out wrong. I guess its up to me to make a decision. I will pay Kishore $50 and Oli3L $25. Thats the best I can do. Hope thats ok guys.