Help - Search - Members - Calendar
Full Version: Help With Javascript
MonsterSmallBusiness Forums > MonsterCommerce > How do I?
agkits
I am not sure what exactly is happening here but I am having trouble with a Javascript works in Firefox and IE in 4.x. However it does not work in V7.

Here is the example:
http://www.agkits.com/index.asp?PageAction...mp;ProdID=30413

The script is the mouseover popup when you hover over the little "?" in the bubble in the right corner of each section. I'll call them hints.

Now if you look at the above page the code popup works in IE, Firefox and Safari.


Looking at it in V7 ...
http://02b03ef.netsolstores.com/Allis-Chal...ebuild-Kit.aspx

Not changing the .js files... It does work in Safari and Firefox still, but not IE.

When I look at the error at the bottom left corner of IE it gives me this info.

Line: 99
Char: 2
Error: Invalid argument
Code: 0

I am losing my mind trying to figure out why this isn't working. Any help would be greatly appreciated. blinking.gif

Thanks
Justyn
ArcoJedi
Justyn,

They are working for me in IE6. I'm not sure what would cause any differences and I have not looked at the code as of yet.
AndyT - MC
From what I can see, this is the function and specific line:

CODE
function TTipMove (id) {
...
    this.iframes[id].o_css.height = (n_h-this.top) + 'px';
...
}

In IE7, "n_h" = 1 and "this.top" = 5 (1-5 = -4), and it is trying to set the height to -4px, which is illegal in terms of height. Set an if() statement around it to determine if it is greater than zero before setting the height:

CODE
if (n_h-this.top > 0) {
  this.iframes[id].o_css.height = (n_h-this.top) + 'px';
}
agkits
Wow thanks for the quick responses! ... Ok just to make sure I got this right this is what I have now.

CODE
    if (n_h-this.top > 0) {
    this.divs[id].o_css.left = n_x + 'px';
    this.divs[id].o_css.top = n_y + 'px';
    this.iframes[id].o_css.left = n_x + 'px';
    this.iframes[id].o_css.top = n_y + 'px';
    this.iframes[id].o_css.height = (n_h-this.top) + 'px';
    this.iframes[id].o_css.width = (this.getSize(id, false)-this.left) + 'px';
    }


It works... well sort of works. It shows up now but it is positioned absolute 0,0 in the top left corner. (Again only in IE)

I thought I could have put it in the wrong place all together thats why it was doing that... so I tried this:

CODE
    this.divs[id].o_css.left = n_x + 'px';
    this.divs[id].o_css.top = n_y + 'px';
    this.iframes[id].o_css.left = n_x + 'px';
    this.iframes[id].o_css.top = n_y + 'px';
        if (n_h-this.top > 0) {
    this.iframes[id].o_css.height = (n_h-this.top) + 'px';
        }
    this.iframes[id].o_css.width = (this.getSize(id, false)-this.left) + 'px';


But that didn't work.
AndyT - MC
Define didn't work? Still an error or just not what you expected?

I meant for the if() statement to surround the height setting line only, not the entire section. Try just commenting out that single line to see what you get.
agkits
I got the error except it pushed the line error from 99 to 102 and it doesn't popup. I'm going to try something else quick... i'll post if it works.
agkits
Original code was from http://www.softcomplex.com/products/tigra_hints/

Checked the version of the code and there is an updated version now. Problem Solved. Pretty much had to redo the code I used in my custom CSS and my product template but it works in all browsers now! Thanks Andy.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.