473,804 Members | 3,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

resizing problem...Urgen t!

Hi,
i have a big problem...i'm using one jscript for resizing of all of my pics
in popUp...in main html i'm having many little pics and clicking on them
they open in popUp and resize to larger version of the same pic.
now, it works fine and sometimes when i click on little one it doesn't
resize well...
this is the code:

main.html

<a href="#" onclick="javasc ript:
window.open('/html/popUp.html','Ma lo','toolbar=0, location=0,dire ctories=0,st
atus=0,menubar= 0,scrollbars=0, resizable=0');r eturn false;">
<IMG src="/images/thumbs/Malo.jpg" border="0">
</a>

popUp.html

<script language="JavaS cript">
var pic = new Image();
var url='/images/pics/'+name+'.jpg'; // name='Malo' from main.html
pic.src = url;
function resizing(){
window.location =url;
var wid=pic.width+3 0; // sometimes pic.width=0 and wid=30 and
sometimes is OK
var hei=pic.height+ 50; // sometimes pic.height=0 and hei=50 and
sometimes is OK
alert("wid="+wi d+"\n"+"hei="+h ei);
window.resizeTo (wid, hei);
}
</script>

</head>

<body onload="javascr ipt: resizing();">

</body>
i don't know what hapens...maybe some pic doesn't have time to load so
pic.width and height is 0 but when i close popUp and open it again for the
same pic, it resizes well...i mean, the pic that resizes wrong second time
resizes well...
If someone know what i'm doing wrong help please!!!
Thank You very much!
Jul 20 '05
10 2336
mscir wrote:
<snip>
function popup(url,windo wname,width,hei ght) {
width=(width)?w idth:screen.wid th/3;
height=(height) ?height:screen. height/3;
var screenX = (screen.width/2 - width/2);
var screenY = (screen.height/2 - height/2);
Dimensions and positioning based on screen.width/height are problematic
at best. The - availWidth - and - availHeight - properties, where
available and properly implemented, should take into account details of
the desktop such as taskbars, which have no fixed number, location or
dimensions.

But even then, screen dimensions are meaningless to, for example,
Opera's MDI interface, and positioning based on those dimensions can be
terribly wrong in multi-monitor configurations.
var features= "width=" + width + ",height=" + height;
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY +",top=" + screenY;
var mywin=window.op en(url, windowname, features);
if (mywin)
mywin.focus();
return mywin;
}

var myimage = new Image();
var popupwin=null;

myimage.onload= function(){
popupwin=popup( this.src,"pic", this.width+20,t his.height+20)
}

<snip>

It is an unfortunate truth that only a subset of Image object
implementations will trigger an onload event when (and if) the browser
downloads the corresponding image file, and also that only a subset of
Image object implementations will transfer the dimensions of any image
file downloaded into the - width - and - height - properties of the
Image object. Making the whole approach inappropriate outside of an
Intranet. It is also unnecessary to need to dynamically read the image
dimensions as knowing the URL implies knowing the dimensions, trying to
take this shortcut is a route to otherwise avoidable failure with many
browsers.

Adding fixed values to take account of window chrome and default margins
and paddings is not appropriate as all of those properties are variable
under user control and any fixed value can only be the default (possibly
for only a limited range of browsers) on one OS/Window manger. One of
the main reasons that opened windows should not be prevented form being
resizable (as they are in the example - popup - function).

Richard.
Jul 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2700
by: Alex Hopson | last post by:
I'm using the code below to loop through some images and resize each image twice, once to create a thumbnail and once to create a small image. The page stops loading around the 38th image out of 40+. Not always the same place but it's either 38th or 39th image, which I find strange as it's not consistent. At first I thought it was a timeout problem so I added - set_time_limit(0); and ignore_user_abort (true); to prevent it timing out,...
12
6737
by: Søren Reinke | last post by:
Hi there I have a little problem. How do i make sure that a graph is not redrawn while the form with the graph is being resized ? I have tried to add a mouse up/down event handler on the form1, but it dosn't get called when resizing :( I would like to be able to resize my form, but also make sure the graph is
5
2351
by: bruno | last post by:
I have a .aspx with a TreeView in the left hand and a GridView or a FormView in the right hand. I would like to resize the two sides like in http://msdn.microsoft.com/library/default.asp, but I didn't find the solution. Can I get any help? Just a sample or a link to where I can learn about. Thank you very much. -- bruno
6
2266
by: tomasio | last post by:
Dear NG, years have passed and I am still more designer than programmer. I build a new version of my website which has a few nasty bugs, especially on my startpage: Resizing text brakes the dotted lines which I use as visual border on the left and right edge of the page layout and thus produces an unwanted white gap above the enlarged text. Viewing the page with IE shows this behaviour even without changing the font size.
1
9177
by: Nick ! | last post by:
Chris Share <usenet at caesium.me.ukwrote: http://web.cs.mun.ca/~rod/ncurses/ncurses.html#xterm says "The ncurses library does not catch signal, because it cannot in general know how you want the screen re-painted". First, is this really true? When I make my xterms smaller they clip what is displayed--is that a function of curses or the xterm? Second, if true, it explains /what/ is going on--stdscr, only--, but isn't really...
6
4550
by: JDeats | last post by:
I have a WinForms based application written for the .NET Framework 2.0 and in this application I need to be able to be able to take some action in code when the user finishes resizing the form. I can easily create an event handler for the SizeChanged form level event, the problem is if the user is using a mouse drag to resize the form this event is firing every few milliseconds or what have you until the user stops the drag process. ...
9
5315
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from http://blogs.crankygoblin.com/blogs/geoff.appleby/pages/50712.aspx. I've also read the post on this topic by bggraphics, but he doesn't arrive at a final result. The main problem I am having is that the layerX and layerY event properties don't work. They're supposed to return the...
8
8449
by: Steve | last post by:
Hi All I have written some code to rescale my windows forms application forms depending on the users screen resolution The application is designed for 1024 x 768 but some customers have 19" screens and want to use 1280 x 1024 etc I am using vb.net 2005 Code sample..............................................................
10
7082
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for only small sized iamages.. for eg. resizing takes place for 70 kb sized images but fails for 600kb or more.. my code is below..
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.