Solved

createpopup() questions

Posted on 2004-09-22
6
1,061 Views
Last Modified: 2008-01-09
I have two questions:
1. Can you hide the scrollbar when using the createpopup method?
var oPopup = window.createPopup();
var objDocument = oPopup.document;
objDocument.open();
objDocument.write(HTML);
objDocument.close();
oPopup.show(l,t,186,166,document.body);
No matter what I do the scrollbar always appears on the popup. The height of some of the HTML is set to 100% could that be the cause?

2. The HTML above contains a link to some javascript <script language="javascript" src="myJSfile.js"></script> but it does not appear to load this javascript because I get an object not found when calling when one of the methods within myJSfile.js. Can the popup window load javascript dynamically or does the javascript have to be typed out within the page?  I have verified that typing the javascript out in the HTML variable does work.

Thanks in advance for your help.
0
Comment
Question by:dswisstack
  • 3
  • 3
6 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 12127469
Hi dswisstack,

1) If you must use an IE-only createPopup() function, your code will show a scrollbar because of the way you're calling it.

Do this:

var oPopup = window.createPopup();
var objDocument = oPopup.document.body;
objDocument.style.border = "1px solid black";
objDocument.innerHTML = HTML;
objPopup.show(l,t,186,166,document.body);

Since you're using createPopup(), the innerHTML shouldn't matter anyways.


Apparently, though, as I was reading your question, I noticed that you can't use innerHTML because you're including a whole document. As per say, you can set your body style to overflow:hidden; or even overflow-y:hidden since this is going to be IE only. However, the default overflow:auto; should work AS long as your document doesn't exceed the window.

Note, that you can set the window height here:

objPopup.show(l,t,186,166,document.body);

Just change 166 to something higher since including a document always adds one line of space at the top and the bottom.


2) Try my suggestions above first and we'll see...

Regards,
Zyloch
0
 

Author Comment

by:dswisstack
ID: 12127634
overflow:hidden worked great and answers question #1

But I still cannot get #2 to work any ideas there?

Here is some more info:
I have a link to a stylesheet in the HTML as well and it loads the stylesheet just fine.
<LINK href="my.css" type="text/css" rel="stylesheet">

but the next line does not appear to load...
<script language="javascript" src="myJS.js"></script>

When I cut the contents of myJS.js and include it in the HTML it works.


Thanks Zyloch!
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12127718
That's odd. What is in your JS if you can show me...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:dswisstack
ID: 12127834
It's really nothing out of the ordinary....

Within the <body> of the HTML on the last line I have this...
<script language='javascript'>RegisterMiniCalendar('MiniCalendar1', '09222004', 'MiniCalendar1DayCell09222004', true, 'doNothing', 'HandleDateSelected')</script>

The function RegisterMiniCalendar is in a script that is included in the HTML's <head> element as...
<script language="javascript" src="/Javascript/MiniCalendar.js"></script>
SRC is a fully qualified path the the file. I have validated that the SRC is correct by calling another JS file in the same location that is an ASPX page (JS.aspx) and setting a break point (the break point gets hit).

If I take the function out of the include and just put it within a <script> block in the HTML variable it finds it and everything works great. But I'd prefer not to do it this way.

0
 
LVL 36

Accepted Solution

by:
Zyloch earned 125 total points
ID: 12127895
We can try it the Microsoft way (since this is IE only anyways)

On your main page have this:

<download id="pop1" style="behavior:url(#default#download);" />

Then in your <script> tag have a function like this:

function oDone(src) {
   oPopup.document.write(src);
}

Call it when you need to with this:

pop1.startDownload("youHtmlFile.html",onDone);      

This may be better in that you don't have to store the contents in a HTML variable.
0
 

Author Comment

by:dswisstack
ID: 12127937
It appears that the includes have not loaded by the time that the RegisterMiniCalendar function is called. Therefore it does not exist. I wrapped the RegisterMiniCalendar call within a method and call it on the window's onload event and the problem is solved.

Thanks again for your help Zyloch!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now