PDA

View Full Version : OOP/JS and showModelessDialog


jbot
10-13-2004, 04:37 PM
Hi,

I'm writing a cross-browser modeless dialog control using OOP. however, in IE it fails when the return value of the modeless dialog is set using OOP as opposed to a normal value. basically, it shows a directory listing in the parent window. the same code but using a standard return value works fine. any ideas as to why this would be happening.

(btw: this is the IE specific code. FF works just fine with its part.)

lookup=
{
name:"lookup",

create:function()
{
this.url = arguments[0] ? arguments[0] : "about:blank" ;
this.width = (arguments[1] ? arguments[1].split(",")[0] : "500") + "px" ;
this.height = (arguments[1] ? arguments[1].split(",")[1] : "500") + "px" ;

if (window.showModelessDialog)
{
this.features = "dialogWidth:"+this.width+"; dialogHeight:"+this.height+"; resizable:Yes; center:Yes" ;
this.win = window.showModelessDialog(this.url, this.name, this.features) ;
}
}
}

the offending code is in red!

cheers,
John :confused:

jbot
10-14-2004, 09:50 AM
bump ...

no takers, then :(

Willy Duitt
10-14-2004, 10:22 AM
bump ...

no takers, then :(

not enough information...

jbot
10-14-2004, 10:46 AM
not enough information...

i thought my post was self-explantory, but obviously not for some ;)

ok ... i call the above code in IE using lookup.create(URL). however, when i include the red text IE bombs and displays a directory listing. this occurs when run under both file and HTTP protocols.

without the red text it works fine. but I need to reference the dialog as this.win because i use that reference elsewhere. that's not the issue tho - it's the reference which is.

any ideas why this would happen. a normal reference works fine, just not the OOP one. :confused:

Willy Duitt
10-14-2004, 11:03 AM
i thought my post was self-explantory, but obviously not for some

Perhaps you mean sum as in whole as in all as in collectively....

jbot
10-14-2004, 11:08 AM
Perhaps you mean sum as in whole as in all as in collectively....

feeling cheeky today, are we?? hmmmm ... well, seeing as how you really don't want to help then ... well ... don't bother posting anymore :rolleyes:

fci
10-14-2004, 11:11 AM
post more of your code.
I do not understand the 'directory listing' bit. Show us what the code looks like in context so we can debug it.

liorean
10-14-2004, 11:14 AM
JBot - your post and code doesn't explain much. How does the invokation of this function look? Is there an error? What does the error message say? Is the problem that it doesn't pop up the window? What ie version and SP are you trying to use, does it differ if you change to another one? (ie6sp1w and ie6sp2w differ in many windowing and popup handling aspects, for instance.) Finally, how did the code that DID work look?

jbot
10-14-2004, 11:27 AM
got it sorted. not JS problem, but HTML.

original:
<a href="" onclick="lookup.create('http://www.google.com/'); return false">create lookup dialog</a>

sorted:
<a href="#" onclick="lookup.create('http://www.google.com/'); return false">create lookup dialog</a>

somewhat confused tho why the hash should stop the directory listing from showing. shouldn't the "return false" statement prevent IE from trying to parse the href? :confused:

btw: i'm hungover this morning, so feeling kinda grumpy, awkward and slow. apologies if i sounds somewhat vague and/or sarcky :)

Willy Duitt
10-14-2004, 11:37 AM
feeling cheeky today, are we?? hmmmm ... well, seeing as how you really don't want to help then ... well ... don't bother posting anymore :rolleyes:

It has nothing to do with feeling cheeky....

You have answered enough questions yourself to understand how to correctly pose a question and to know that if a question remains unresponded too it is generally because it was poorly constructed and/or presented...

The fact that you felt the need to *bump* your post should have been the first clue that you needed to either elaborate more or provide enough of an example for someone to run the code in order to see the behavior you were trying to describe....

The fact that I mentioned that there was not enough information should have been your second clue... And yes, I can surmise that you are sending the URL and window size as arguements and can quess that the problem is win is not an object....

But somehow, I get the feeling this is not so much of a question as it is an excersise for your arguementative nature...

Have many nice days;
.....Willy

fci
10-14-2004, 11:53 AM
got it sorted. not JS problem, but HTML.

original:
<a href="" onclick="lookup.create('http://www.google.com/'); return false">create lookup dialog</a>

sorted:
<a href="#" onclick="lookup.create('http://www.google.com/'); return false">create lookup dialog</a>

somewhat confused tho why the hash should stop the directory listing from showing. shouldn't the "return false" statement prevent IE from trying to parse the href? :confused:

btw: i'm hungover this morning, so feeling kinda grumpy, awkward and slow. apologies if i sounds somewhat vague and/or sarcky :)


damn! I almost said something like that but I wanted to see more information because deciding. I don't know the answer to your question... probably because then it doesn't read the a href as a link... mm yeah. For a lot of things, it's a "rule", it's just "the way it is" .. the reason why is probably not that important.