#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Coppell, TX
    Posts
    203
    Rep Power
    0

    Is Javascript what I need for opening a window?


    Im currently trying to create a typical thing you see on a web site, where you might have a small image of a product, and by clicking that image, a larger (zoomed) view of the product comes up with a small description.

    I can accomplish this except for the fact that I cannot size the window. Here is the line I have right now:
    PHP Code:
    echo '  <td><a target="_blank" href="zoom_sku.php?sku=' .$sku.'"> <img src="' .$catdir $itempic '" ></a></td>'
    The zoom_sku.php is a small program that reads the sku from a database and gets the description and large picture. This code works, but opens a full browser window in all its splendor. All I want is like a 300x400 window with nothing but an X at the corner where the user can close the box.

    I suspect I have to go to a Javascript "window_open" here. I experimented with it, but was unsure how to syntactically get it to work in this context.

    Can anyone help?

    Thanks very much in advance!

    Kork
    "Any significantly advanced techology is indistiguishable from magic." - Arthur C. Clarke
  2. #2
  3. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    Yes you need to use Javascript, search in the HTML, CSS and Javascript section of the forums and you will find what you need
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Coppell, TX
    Posts
    203
    Rep Power
    0
    Well, not exactly the answer I was looking for a.koepke
    But you've posted > 1000 times which means you are pretty busy here and dont have alot of time to answer specifically. I usually DO research before posting something here, so Im sorry if you felt compelled to respond the way you did.

    The problem revolves around the particular issue of getting the popup to come up, in a PHP written code, where it doesnt kill the page beneath it. If I set the code up in .HTM page, seems to work well, but when its in a .PHP file, it doesnt.

    Here's the closest I've gotten so far:
    PHP Code:
    <td><a href="javascript:window.open('zoom_sku.php?sku=<?php echo $sku ?>','Zoom','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=300,height=225')"><img src="<?php echo $catdir.$itempic ?>"></a></td>
    What that does is render the separate window, fixed, but the current page blanks out with just a single line [object], on it.

    Hopefully, one of you javascript gurus can tell me where my error is, or if you prefer, point me to a link that does this (I have the JavaScript Bible Reference book and it doesnt address this specifically..I've had to improvise.)

    thanks again,
    Kork
    "Any significantly advanced techology is indistiguishable from magic." - Arthur C. Clarke
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    Have you looked at the source that this line generated?
    Also, you don't have to specify the options that you want turned off for window.open(). You only have to specify the options that you want turned on.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Coppell, TX
    Posts
    203
    Rep Power
    0
    Actually i did stumble onto the answer.

    The final resolution was to simply place a "void" in front of the window.open() statement. So instead of:
    PHP Code:
    <td><a href="javascript:window.open(...) 
    It becomes:
    PHP Code:
    <td><a href="javascript:void window.open(...) 
    Of course, java and script and run together...somehow the PHP tags here automatically put a space between them..annoying!

    Amazing how something so simple can fix the problem!

    Kork
    "Any significantly advanced techology is indistiguishable from magic." - Arthur C. Clarke

IMN logo majestic logo threadwatch logo seochat tools logo