window - jscript and vbscript

Discussion in 'ASP General' started by Eugene Anthony, Jun 20, 2006.

  1. I am using javascript to open the pop up window. Now the pop up window
    will be displayed in a center position and in it the images will be
    displays (one image at a time as the next and previous button is
    clicked). The images are retrieved and displayed using asp. Now is there
    a way to shrink the size of the image so that it fits the size of the
    pop up window and when I click on the image the image will be resized to
    its original size.

    For example:

    <HTML>
    <Head>
    <Script Language="JavaScript">

    function openFullSize(Pix)
    {
    nullIMG.src = Pix;
    wStr = nullIMG.width;
    offsetW = wStr;
    wStr = wStr-5;
    wStr = "width="+wStr;
    hStr = nullIMG.height;
    offsetH = hStr;
    hStr = hStr-35;
    hStr = "height="+hStr;
    lStr = (screen.Width/2 - offsetW/2);
    lStr = "left="+lStr;
    tStr = (screen.height/2 - offsetH/2);
    tStr = "top="+tStr;

    window.open(Pix,"FullSize","toolbar=0,status=0,scrollbars=yes,
    "+tStr+","+lStr+","+wStr+","+hStr+" ");

    }

    function buildSupport()
    {
    styleStr = "<Style> .placeHolder
    {Position:Absolute;Top:-2000;};</Style>";
    divStr = "<Div class=placeHolder><IMG Src=Null ID=nullIMG></Div>"
    document.write(styleStr);
    document.write(divStr);
    }

    buildSupport();

    </Script>


    <Body>
    <center>
    <H3>Thumbnail link to clean, dynamically sized window</H3>
    <a
    href=javascript:eek:penFullSize('http://www.mama.com/db/Upload/photos/natur
    e/06331_30.jpg')><img
    src='http://www.mama.com/db/Upload/photos/nature/06331_30.jpg'
    width='140' height='105' alt='Click to enlarge'></a>
    </center>
    </Body>
    </HTML>

    I came up with this example using jscript

    and I require something like this to work on asp.

    Eugene Anthony

    *** Sent via Developersdex http://www.developersdex.com ***
    Eugene Anthony, Jun 20, 2006
    #1
    1. Advertising

  2. Eugene Anthony

    James Jones Guest

    not sure if this is a valid code, but we can try it, lol.


    divStr = "<Div class=placeHolder><IMG Src=""Null ID=nullIMG height=""100%""
    width=""100%""></Div>"



    hope this works for you....i kno it works for other html items














    "Eugene Anthony" <> wrote in message
    news:...
    >I am using javascript to open the pop up window. Now the pop up window
    > will be displayed in a center position and in it the images will be
    > displays (one image at a time as the next and previous button is
    > clicked). The images are retrieved and displayed using asp. Now is there
    > a way to shrink the size of the image so that it fits the size of the
    > pop up window and when I click on the image the image will be resized to
    > its original size.
    >
    > For example:
    >
    > <HTML>
    > <Head>
    > <Script Language="JavaScript">
    >
    > function openFullSize(Pix)
    > {
    > nullIMG.src = Pix;
    > wStr = nullIMG.width;
    > offsetW = wStr;
    > wStr = wStr-5;
    > wStr = "width="+wStr;
    > hStr = nullIMG.height;
    > offsetH = hStr;
    > hStr = hStr-35;
    > hStr = "height="+hStr;
    > lStr = (screen.Width/2 - offsetW/2);
    > lStr = "left="+lStr;
    > tStr = (screen.height/2 - offsetH/2);
    > tStr = "top="+tStr;
    >
    > window.open(Pix,"FullSize","toolbar=0,status=0,scrollbars=yes,
    > "+tStr+","+lStr+","+wStr+","+hStr+" ");
    >
    > }
    >
    > function buildSupport()
    > {
    > styleStr = "<Style> .placeHolder
    > {Position:Absolute;Top:-2000;};</Style>";
    > divStr = "<Div class=placeHolder><IMG Src=Null ID=nullIMG></Div>"
    > document.write(styleStr);
    > document.write(divStr);
    > }
    >
    > buildSupport();
    >
    > </Script>
    >
    >
    > <Body>
    > <center>
    > <H3>Thumbnail link to clean, dynamically sized window</H3>
    > <a
    > href=javascript:eek:penFullSize('http://www.mama.com/db/Upload/photos/natur
    > e/06331_30.jpg')><img
    > src='http://www.mama.com/db/Upload/photos/nature/06331_30.jpg'
    > width='140' height='105' alt='Click to enlarge'></a>
    > </center>
    > </Body>
    > </HTML>
    >
    > I came up with this example using jscript
    >
    > and I require something like this to work on asp.
    >
    > Eugene Anthony
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    James Jones, Jun 21, 2006
    #2
    1. Advertising

  3. Eugene Anthony

    James Jones Guest

    well i was looking at your code after i posted the last post........its in
    javascript, so you can just use the height and width you already have
    defined......try rewriting your buildSupport function with
    this...............




    function buildSupport()
    {
    styleStr = "<Style> .placeHolder
    {Position:Absolute;Top:-2000;};</Style>";
    divStr = "<Div class=placeHolder><IMG Src=Null ID=nullIMG" + hstr + " " +
    wstr + "></Div>"
    document.write(styleStr);
    document.write(divStr);
    }



    notice the variables you already have stored are being used to resize each
    image loaded..........hope this really works for ya!







    "Eugene Anthony" <> wrote in message
    news:...
    >I am using javascript to open the pop up window. Now the pop up window
    > will be displayed in a center position and in it the images will be
    > displays (one image at a time as the next and previous button is
    > clicked). The images are retrieved and displayed using asp. Now is there
    > a way to shrink the size of the image so that it fits the size of the
    > pop up window and when I click on the image the image will be resized to
    > its original size.
    >
    > For example:
    >
    > <HTML>
    > <Head>
    > <Script Language="JavaScript">
    >
    > function openFullSize(Pix)
    > {
    > nullIMG.src = Pix;
    > wStr = nullIMG.width;
    > offsetW = wStr;
    > wStr = wStr-5;
    > wStr = "width="+wStr;
    > hStr = nullIMG.height;
    > offsetH = hStr;
    > hStr = hStr-35;
    > hStr = "height="+hStr;
    > lStr = (screen.Width/2 - offsetW/2);
    > lStr = "left="+lStr;
    > tStr = (screen.height/2 - offsetH/2);
    > tStr = "top="+tStr;
    >
    > window.open(Pix,"FullSize","toolbar=0,status=0,scrollbars=yes,
    > "+tStr+","+lStr+","+wStr+","+hStr+" ");
    >
    > }
    >
    > function buildSupport()
    > {
    > styleStr = "<Style> .placeHolder
    > {Position:Absolute;Top:-2000;};</Style>";
    > divStr = "<Div class=placeHolder><IMG Src=Null ID=nullIMG></Div>"
    > document.write(styleStr);
    > document.write(divStr);
    > }
    >
    > buildSupport();
    >
    > </Script>
    >
    >
    > <Body>
    > <center>
    > <H3>Thumbnail link to clean, dynamically sized window</H3>
    > <a
    > href=javascript:eek:penFullSize('http://www.mama.com/db/Upload/photos/natur
    > e/06331_30.jpg')><img
    > src='http://www.mama.com/db/Upload/photos/nature/06331_30.jpg'
    > width='140' height='105' alt='Click to enlarge'></a>
    > </center>
    > </Body>
    > </HTML>
    >
    > I came up with this example using jscript
    >
    > and I require something like this to work on asp.
    >
    > Eugene Anthony
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    James Jones, Jun 21, 2006
    #3
  4. I modified the javascript:

    <HTML>
    <Head>
    <Script Language="JavaScript">

    function openFullSize(Pix)
    {
    img = new Image()
    img.src = Pix;
    wStr = img.width;
    offsetW = wStr;
    wStr = wStr-5;
    wStr = "width="+wStr;
    hStr = img.height;
    offsetH = hStr;
    hStr = hStr-35;
    hStr = "height="+hStr;
    lStr = (screen.Width/2 - offsetW/2);
    lStr = "left="+lStr;
    tStr = (screen.height/2 - offsetH/2);
    tStr = "top="+tStr;
    window.open(Pix,"FullSize","toolbar=0,status=0,scrollbars=yes,
    "+tStr+","+lStr+","+wStr+","+hStr+" ");
    }

    </Script>


    <Body>
    <center>
    <H3>Thumbnail link to clean, dynamically sized window</H3>
    <a
    href=javascript:eek:penFullSize('http://www.mutaiyas.com/db/Upload/photos/n
    ature/06331_30.jpg')><img
    src='http://www.mutaiyas.com/db/Upload/photos/nature/06331_30.jpg'
    width='140' height='105' alt='Click to enlarge'></a>
    </center>
    </Body>
    </HTML>


    Now is it possible to parse the width and height value of the javascript
    to asp. One possible way I can think of is to place the value in a
    hidden text field and retrieve it using request.form().

    Eugene Anthony

    *** Sent via Developersdex http://www.developersdex.com ***
    Eugene Anthony, Jun 21, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Maz
    Replies:
    4
    Views:
    1,265
    Jon Maz
    Sep 9, 2004
  2. Maxwell2006
    Replies:
    5
    Views:
    2,389
    Steven Cheng[MSFT]
    Mar 7, 2006
  3. Christopher Brandsdal

    JScript and VBscript

    Christopher Brandsdal, Dec 18, 2003, in forum: ASP General
    Replies:
    24
    Views:
    298
    Roland Hall
    Dec 31, 2003
  4. Christopher Brandsdal

    VBscript and JScript

    Christopher Brandsdal, Jan 22, 2004, in forum: ASP General
    Replies:
    3
    Views:
    144
    Christopher Brandsdal
    Jan 22, 2004
  5. Serge Myrand

    VBScript and JScript

    Serge Myrand, Jul 14, 2004, in forum: ASP General
    Replies:
    3
    Views:
    116
    Aaron [SQL Server MVP]
    Jul 14, 2004
Loading...

Share This Page