PDA

View Full Version : Modless Window HELL oops I mean Help



pjdbck
11-25-2005, 05:29 AM
:confused: I need to have a modless window open only on click what needs to be removed to accomplish that?

this is what I have:

<script>

//Modeless window script- By DynamicDrive.com
//for full source code and terms of use
//visit http://www.dynamicdrive.com

function modelesswin(url,mwidth,mheight){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"","help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
else
eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=1")')
}

//configure URL and window dimensions (width/height)
modelesswin("http://www.yahoo.com",840,600)

//To load via link, use something like below:
//<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>
</script>

pjdbck
11-25-2005, 03:49 PM
I did not include a url to the page with the previous question because it is not live let, does any one have any answers? is this possible?

ddadmin
11-25-2005, 09:04 PM
., in this case: http://www.dynamicdrive.com/dynamicindex8/modelesswin.htm

Actually this is already explained inside the script:



//configure URL and window dimensions (width/height)
modelesswin("http://www.yahoo.com",840,600)

//To load via link, use something like below:
//<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>


In other words, such a link would look like:


<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>

pjdbck
11-26-2005, 03:55 AM
OK I am not trying to be stupid but i am beginning to feel that way... Are you saying that I need to replace :



//configure URL and window dimensions (width/height)
modelesswin("http://www.yahoo.com",840,600)

with:


<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>

because if so that does not work. I want the modless window to open only on click not automatically when that page is loaded.

Feeling stupid....
:o
Paul

pjdbck
11-26-2005, 04:02 AM
OK I am stupid...

Here is the real question can I place:


<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>

in a flash movie that is the menu on the page?

Will this script work or should i try somehting else :o

jscheuer1
11-26-2005, 05:19 AM
OK I am stupid...

Here is the real question can I place:


<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>

in a flash movie that is the menu on the page?

Will this script work or should i try somehting else :o

That could work but, the entire script may need to be hard coded into the swf file. I'd try it first with the script on the page and just the above link hard coded into the swf file though.

pjdbck
11-26-2005, 04:35 PM
not working John... is there any other scripts that i would be able to do because i suck at flash anf an not sure how to get all the script into the swf

jscheuer1
11-27-2005, 07:28 AM
You're the one that brought up Flash. I was kind of hoping you knew how to do that. I'm just getting started with it myself. From looking over the program (Flash MX 2004) a few times, it seems that there are ways to insert various things, like javascript, images, text, formatting, etc. One just needs to know how. I also have a book on how to code this stuff but, I have yet to figure out where the two (the program and the book) meet. It is not a top priority with me but, I'm sure I will get around to, if not mastering it, at least getting to where I can do some things.

Well, enough about me. Getting back to your original post in this thread, here is what you need to change to get it to open only onclick (addition red):


<script>

//Modeless window script- By DynamicDrive.com
//for full source code and terms of use
//visit http://www.dynamicdrive.com

function modelesswin(url,mwidth,mheight){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"","help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
else
eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=1")')
}

//configure URL and window dimensions (width/height)
//modelesswin("http://www.yahoo.com",840,600)

//To load via link, use something like below:
//<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>
</script>

Then use a link like the one in the above comment*, in the body** of your page:


<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>

* Comments in javascript start with // and are ignored (to the end of the current line) by the browser. They also can start with /* but then they need to be closed with */ and will span (once again being ignored by the browser) until the closing token is encountered.

** That means somewhere below the <body> tag and above the </body> tag. You know, where all of the regular HTML code goes.