LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   javascript problem with IE (https://www.linuxquestions.org/questions/programming-9/javascript-problem-with-ie-449043/)

alitrix 05-27-2006 09:32 AM

javascript problem with IE
 
Joh,

I'm not good with Javascript but have some basic knowledge and experience.
I have this code:
Code:

function openEditBox(idLink) {
                var width = 750;
                var height = 500;
       
                var x = parseInt(screen.width / 2.0) - (width / 2.0);
                var y = parseInt(screen.height / 2.0) - (height / 2.0);
       
                var win = window.open("popup.php?cmd=modLink&idLink="+idLink, "Modify Link", "top="+y+",left="+x+",scrollbars=no,width="+width+",height="+height+",resizable=yes");

                if (win == null) {
                        alert('Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.');
                        return;
                }
               
                win.focus();
}

Well, as u see, nothign special. Just a function that opens a pop-up where u can edit a link.
I call this function like this:

Code:

<a href="#" onClick="javascript:openEditBox(183)">a link of id 183</a>
Well, Firefox doesn't have any with this link and as I know there isn't anything "wrong" that I'm doing in this codes.
But IE is having trouble with it.
IE is having trouble this line (invalid argument):
Code:

var win = window.open("popup.php?cmd=modLink&idLink="+idLink, "Modify Link", "top="+y+",left="+x+",scrollbars=no,width="+width+",height="+height+",resizable=yes");
Well, I tryed to figure out what the problem is. I removed all the variables and replaced them with my own context, then it worked.
If I try to add just 1 variable, I get this error. It doesn't matter what variable I use, idLink, width,x, y, etc.


Can somebody help me?
What's the problem of IE? Firefox isn't giving me any error and works fine.

Greetz,

alitrix

dannystaple 05-27-2006 04:43 PM

I dont know if it is the posting system parsing your code, but there appears to be something wrong with your quotes on that line. Do you want to double check that they are paired properly? The top argument is either missing, or has an additional quote, and the resizable one too.

Danny

alitrix 05-27-2006 05:40 PM

I didn't understand what u mean

I checked the code, there isn't anything missing. That's the only code that I have, if u mean that.
Can u please specify me what u mean?

Many tnx!

RijilV 05-27-2006 08:57 PM

Code:

resizable=yes"
I think that's the code in question.

could be wrong, I'm probably no help on this one

dannystaple 05-28-2006 04:16 AM

Alitrix,

I mean that it looks very much like you have mismatched your quotes on the line in particular. Count them up, and make sure you are opening, and closing the quotes stuff where it should be. That looks to me to probably be your problem.

Danny

alitrix 05-28-2006 04:45 AM

Well, I counted them and it's all oke
And if it wasn't, then Firefox told me already (I guess?)

@RijilV, There isn't anything wrong with that (if u mean the quotes part)

dive 05-28-2006 09:20 AM

The quotes are fine. Have you tried playing with the path to popup.php? Maybe put a / in front or something? Or even ./ or maybe full path with http?

Dunno just an idea. But the problem is with IE I think - the code looks fine.

alitrix 05-28-2006 09:22 AM

Well, I don't think that helps.

U see, if I gave it a wrong URL/file , then I would get a pop-up with a 404 inside of it.
But instead of that I get a error (only in IE, FF doesn't have any trouble with it)

So I don't think IE is looking to the path's, cause it isn't even opening a pop-up

dive 05-28-2006 04:46 PM

You don't have any popup blocking IE? Just a thought.

smallville 05-31-2006 10:14 PM

your script looks like you're writing the script like this:

message="y="20", x="20""

instead of using " try this:

message="y='20', x='20'"


All times are GMT -5. The time now is 04:14 PM.