window.location ------ how to display a file in a new window ?

Posted on 2007-07-20
Last Modified: 2008-03-03
For the following html, the myfile.pdf will be displayed in the same window.

<tr> <td  onmouseover="className='over'" onmouseout="className='out'" onclick="window.location=myfile.pdf'"><div align="center"><strong>Display in a new window</strong></div></td></tr>

<tr>..... </tr>

Is that possible that to display myfile.pdf in a new window?

Thanks for your reply,
Question by:lilyyan
    LVL 13

    Accepted Solution

    You don't need javascript to do this. This can be done using plain HTML. See

    <a href="myfile.pdf" target="_blank">Display in a new window</a>
    LVL 1

    Assisted Solution

    If you want to use Javascript to have more control over how the window looks, try onclick="'myfile.pdf','newWin')".

    You can then add various switches to allow/disallow such interesting this as address bar, menu bar etc..


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
    "I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
    In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
    The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now