/    Sign up×
Community /Pin to ProfileBookmark

window.createPopup() size

I am using window.createPopup() to open little popup windows with help tips inside them. Although I have scroll bars on them so they can cope with displaying different amounts of data, I would like to dynamically resize them to suit what they are displaying.
Is this possible?
Thanks for any help.

to post a comment
JavaScript

11 Comments(s)

Copy linkTweet thisAlerts:
@requestcodeOct 21.2003 — What is window.createPopup()? Is that a script that was created for you? If it is can we see it?
Copy linkTweet thisAlerts:
@fredmvOct 21.2003 — I would strongly recommend against using this method as it is IE-only. However, you may find [url=http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/createpopup.asp]this[/url] helpful.
Copy linkTweet thisAlerts:
@WebskaterauthorOct 21.2003 — window.createPopup is a Microsoft dhtml thing that allows you to create popup windows with features such as scroll bars, borders etc but no chrome. Thanks for the link to the ms site - I am already pretty familiar with the concept - but what I really need to find out is if they can resize dynamically to fit the content.

As far as them only being IE compatible, I am less and less interested in developing for people who, because of some anti Microsoft feeling, are unwilling to put a free piece of software on their computer which allows them to enjoy a much more sophisticated application interface.
Copy linkTweet thisAlerts:
@nkaisareOct 21.2003 — [i]Originally posted by Webskater [/i]

As far as them only being IE compatible, I am less and less interested in developing for people who, because of some anti Microsoft feeling, are unwilling to put a free piece of software on their computer which allows them to enjoy a much more sophisticated application interface.[/QUOTE]

You probably haven't bothered to take a look at other browsers like Opera, Mozilla, Firebird etc. IE comes installed on the PC with Windows. In all probability, people using browsers other than IE do so as a [b]choice[/b] because these browsers happen to provide more than IE, are customizable and have much lesser security flaws.

I am not trying to undermine IE, which is a decent browser; but merely on the merit of being a browser that 80 to 90% of PC owners use does not make it the most advanced. Not all people using browsers other than IE are anti-MS.

(BTW, some of your IE-specific functions may fail in a very-much-Microsoft IE/Mac.)

For your information, IE6 is the last free browser from MS. While other browsers will continue to remain free (or at least thats what we hope), MS is planning to integrate IE with Win-Longhorn, and will no longer support the standalone browser.

If an equally simple, standards compliant method exists, why use a browser-specific method?
Copy linkTweet thisAlerts:
@TomDenverOct 21.2003 — Coding for IE only is fine for your personal sites, but if you work for someone you're going to have to code for many browsers usually, at the very least IE6 and NN7, and usually more than that.

I've been pretty lazy about this myself. I make stuff work in the 2 I mentioned. I know that Mozilla is very similar to NN7, so I think that most stuff that works in NN7 will usually work in Mozilla. Opera I have no clue about.

As for people who have JavaScript turned off.....I tend to ignore this demographic.
Copy linkTweet thisAlerts:
@nkaisareOct 21.2003 — Well, you may want to code "independent of the browser" by sticking to the W3C recommendations, and then implement browser-specific hacks to make them work in specific browsers of your interest. That kind of development, at least to me, seems more robust than "cross-browser" development.

As for people who have JavaScript turned off.....I tend to ignore this demographic.[/quote]
Instead, you can tweak your javascript a little to ensure they aren't ignored. You can do more critical tasks (such as form submission) at non-js level.

Remember, the Sydney Olympic committee was successfully sued because their site was inaccessible in non-javascript browser. Personal sites are a lot different story, though
Copy linkTweet thisAlerts:
@TomDenverOct 21.2003 — I'm curious, why do people turn off JavaScript anyway? The only answer I can think of is that it works as a primitive pop up blocker by turning it off.
Copy linkTweet thisAlerts:
@WebskaterauthorOct 22.2003 — I am curious about the Sydney Olympic thing - what kind of a nutty world lets someone be sued for providing something that some people cannot use. Should escalator manufacturers be sued for making something a wheelchair user cannot use. Should Mercedes be sued for making cars I cannot afford? Should people who make spectacles be sued because people who are blind cannot use them.

I develop sites for business users - I say to them "to make my application as easy to use as possible - and to give it enhanced useability features - you need to be running IE5.5 or later to use it - take it or leave it - if you don't want to use my application because you insist on a different or older browser - thats your choice.

Anyway, what about popup windows created using window.createPopup - can they be dynamically re-sized to suit their content?
Copy linkTweet thisAlerts:
@daviddavidsonAug 18.2004 — Wow, that thread degraded in a hurry. To answer the original question, place the popup's contents into a div with the visibility style set to hidden and then open the popup window with a height of the div's offsetHeight. You cannot resize a popup window after it's displayed. Using a div causes IE to render the text (even though it's hidden) and allows you to access the size of that text. Set the div's width to the standard width for your popups, or use the expression (dynamic properties) syntax to set the width to something like half of the body's clientWidth. The div's offsetHeight will automatically adjust to the wrapped content and always provide you with an accurate number. You can even use the innerHTML property to populate your popup window on-the-fly and use one popup object for all of your popups. Remember to add some padding to your popup's height if it's displaying a border.
Copy linkTweet thisAlerts:
@jbotAug 19.2004 — [i]Originally posted by TomDenver [/i]

[B]I'm curious, why do people turn off JavaScript anyway? The only answer I can think of is that it works as a primitive pop up blocker by turning it off. [/B][/QUOTE]


JS can transport viruses and spyware. this is more so using IE than anything else, because JScript (M$'s implementation of JS) can be used to code the OS. The mechanism for doing this is called ActiveX.

If wanted to i could code a JS to delete important files from your PC, thus disabling it. I know of several nasty (tho seeminly innocuous methods) to do this, and you as a user would be none the wiser till your PC failed. it's much easier than you think.

that's why I surf (even when using FF) with JS turned off.
Copy linkTweet thisAlerts:
@eidentityMar 02.2005 — All the Political stuff aside, I see what you mean about the sizing, I realize this thread is a year old, but here is a compartmentalized take off on the microsoft example that autosizes the PopUp, hope somebody can use this. NOTE:: take the space out of the '&nbsp ;' so it works correctly...

<script><!--//

var myPopup = window.createPopup();

function PopUp(textMessage)

{

// EXAMPLE :: onmouseover="PopUp('Some Message');" onmouseout="myPopup.hide();"

var myPopBody = myPopup.document.body;

var myPopupDiv = document.createElement('DIV');

var myPopupWidth = 0;

var myPopupHeight; = 0;

var myPopupOffSet = 20;

var myPopupXBuffer = 4;

var myPopupYBuffer = 4;

var modifiedtextMessage = new String(textMessage).replace(/ /gi,'&nbsp ;');

//Set Up Da' Pop Up

with(myPopBody)

{

//General Appearance

style.textAlign = 'center';

style.verticalAlign = 'middle';

style.backgroundColor = 'lightyellow';

style.border = 'solid black 1px';

//Font Settings

style.fontFamily = 'Arial';

style.fontWeight = 500;

style.fontStyle = 'normal';

style.fontSize = '8pt';

style.color = '#004080';

}

//Determine Actual Width

with(myPopupDiv)

{

id = 'myPopupDiv';

style.position = 'absolute';

style.visibility = 'hidden';

style.fontFamily = myPopBody.style.fontFamily;

style.fontWeight = myPopBody.style.fontWeight;

style.fontSize = myPopBody.style.fontSize;

style.fontStyle = myPopBody.style.fontStyle;

innerHTML = modifiedtextMessage;

}

this.document.body.appendChild(myPopupDiv);

//Display Da' Pop Up

myPopupWidth = (myPopupDiv.clientWidth + myPopupXBuffer)

myPopupHeight = (myPopupDiv.clientHeight + myPopupYBuffer);

myPopBody.innerHTML = modifiedtextMessage;

myPopup.show((window.event.x + myPopupOffSet), window.event.y, myPopupWidth, myPopupHeight, this.document.body);

}

//--></script>
×

Success!

Help @Webskater spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...