?
Solved

createpopup() questions

Posted on 2004-09-22
6
Medium Priority
?
1,068 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

719 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