Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1075
  • Last Modified:

createpopup() questions

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
dswisstack
Asked:
dswisstack
  • 3
  • 3
1 Solution
 
ZylochCommented:
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
 
dswisstackAuthor Commented:
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
 
ZylochCommented:
That's odd. What is in your JS if you can show me...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
dswisstackAuthor Commented:
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
 
ZylochCommented:
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
 
dswisstackAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now