WordPress.org

Forums

[resolved] How to add a image that opens in a new window (7 posts)

  1. domesticlife
    Member
    Posted 9 years ago #

    I have a daily cartoon that I would like to open in a new window when someone clicks on the link. The main reason is because it is too wide for my site design and messes up the sidebar. I'd be greatful for any help.

    Thanks
    John
    http://www.domesticlife.org

  2. toughIQ
    Member
    Posted 9 years ago #

    hi,
    do you mean, for example, to add a java script to open images on click?

    i added the following code to my headers file.

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function zoom(img, w, h) {window.open(img,'zoom'+w+h,'toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width='+w+',height='+h);}
    // -->
    </SCRIPT>

    when posting, i add the following as link to the image:

    <a href="javascript:zoom('http://url.to/large_image.jpg', 200, 300);" onmouseover="self.status='Zoom In';return true">

    the parameters are: image location, width (in pix), height (in pix).
    the mouse over thing is for not showing off the javascript link in the status bar of your browser.

    an example can be found at: My Blog

    hope this is, what you where looking for.

    bye, chris

  3. twoalone
    Member
    Posted 9 years ago #

    thank you!!!!!!!!!! i spent hours last night looking for this exact thing.

  4. Beel
    Member
    Posted 9 years ago #

    You'll need to change the script language stuff (and uncapitalize it) in order for the page to validate.

  5. toughIQ
    Member
    Posted 9 years ago #

    thanks for this hint. i ll do so.

    i changed the capital version to the following:

    <script type="text/javascript">

    now it validates fine.

    bye, chris

  6. twoalone
    Member
    Posted 9 years ago #

    script language stuff?

  7. vkaryl
    Member
    Posted 9 years ago #

    The "script language" usage is no longer valid; it now must read as toughIQ posted above.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags