AlpVir
Posts: 28
Joined: Tue Apr 29, 2008 12:19 pm

Dynamically resize Iframe - link internal

I have carefully read posts
1) 1/4/08 - "Dynamically resize Iframe popup - possible?"
2) 15/2/08 - "WORKING ** ** How to resize an iframe clicking a link internal"
and are faced with a similar problem.

I have prepared a test page.

1) The page is
http://www.lalpinistavirtuale.it/SkiAlp ... 3041&Zona1 =

2) This page has the following 3 points of interest:
a) <script type="text/javascript" src="highslide/highslide-full.js"> </ script>
b) function myresize (w, h) (
var exp = hs.getExpander ();
var = args (
width: w,
height: h,
dX: 0,
dY: 0
);
exp.resize (args);
alert ( "function myresize");
);
c) V = chr (34)
X = gfxSpex (ImmSer2, w, h) 'REM calculates the width (w) and height (h) of JPEG ImmSer2
w = w +5: h = h +69
response.write "<a class =" + V + "highslide" + V + "href =" + V + "PersonaliPagina.asp? IDEff =" + cstr (IDEff) + V + "onclick =" + V + "return hs.htmlExpand (this , (targetX: 'ON 75px', targetY: null, objectType: 'iframe', preserveContent: false, width: "+ cstr (w) +", height: "+ cstr (h )+"})"+ V +" > "

3) The page PersonaliPagina.asp has the following two interesting points:
a) V = chr (34)
Lx = request ( "Letter")
ImmSer2 = Server.MapPath ( "\ SkiAlp3 \ ImmaginiPers \" IDEff + + "person" Lx + + ". Jpg")
X = gfxSpex (ImmSer2, w, h)
w = w +5: h = h +69
%>
<body
<%
response.write "onload =" + V + "parent.window.myresize (" + cstr (w +1 )+","+ cstr (h +1 )+");"+ V + ">"
%>
Note the +1 that should automatically implement the point where in the post citavano the values 399 and 400.
b) ImmSer5 = Server.MapPath ( "\ SkiAlp3 \ ImmaginiPers \" IDEff + + "person" Lz + + ". jpg")
X = gfxSpex (ImmSer5, w, h)
w = w +5: h = h +69
response.write "<td> <a href = 'PersonaliPagina.asp? IDEff =" + + IDEff "Letter & =" Lz + + "' onclick =" + V + "parent.window.myresize (" + cstr (w) + " "+ cstr (h )+");"+ V +"> "

4) click on the button PERSONAL Gita_BAD2.asp page (the link has the ASP code address in point 2c)

5) displays the image N. 1
With IE 6 NOT you receive the message "function myresize"
With Firefox you receive the message "function myresize"
On http://localhost/ SkiAlp3/Gita_BAD2.asp? .... NEVER receive the message "function myresize" whatever browser you use.
This somewhat surprised !

6) click on the button ">" (forward) whose code is reported in the previous paragraph 3b

7) a) you receive the message "function myresize"
b) expander is totally blank
c) click on the OK button
d) displays the image N. 2
e) you receive a second message "function myresize"
f) click on the OK button
g) all OK
Surprising that this time the message "function myresize" appears 2 times.


Everything works perfectly but the page Gita_BAD2.asp are forced to calculate the image size and pass parameters
w and h at the link point 2c.
That
(targetX: 'ON 75px', targetY: null, objectType: 'iframe', preserveContent: false, width: "+ cstr (w) +", height: "+ cstr (h) +")
This - I suppose - why do not activate the first time the event body onload.


Prefer to avoid this calculation (gfxSpex function) and leave at the body onload page PersonaliPagina.asp the task of resize
expander to the right size.

In other words: You can size exactly expander already the first time that it is activated ?
Something like this:

w = 123: h = 124 ' any values not correspond to the exact size of image and text
response.write "<a class =" + V + "highslide" + V + "href =" + V + "PersonaliPagina.asp? IDEff =" + cstr (IDEff) + V + "onclick =" + V + "return hs.htmlExpand (this , (targetX: 'ON 75px', targetY: null, objectType: 'iframe', preserveContent: false, width: "+ cstr (w) +", height: "+ cstr (h )+"})"+ V +" > "

Having said otherwise:
We must necessarily know the size of the image in Gita_BAD2.asp or you can postpone this knowledge to the next page PersonaliPagina.asp?

I hope to have been clear and I apologize for the imprecision of language, not knowing much English.
AlpVir

Return to “Highslide JS Usage”