Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Opening new windows

  • 18-04-2005 11:12PM
    #1
    Closed Accounts Posts: 927 ✭✭✭


    Hello I haven't much knowledge of web design but need some advice on a problem i have with a simple site. I have a page of thumbnails where links open in a new window but the orignal page reloads every time you click a link. How can I change this so that the original page does not reload?

    Link: http://www.p-art-icles.com/niall


Comments

  • Registered Users, Registered Users 2 Posts: 35,522 ✭✭✭✭Gordon


    You have each link going both to the index html and the destination html.

    a href="index.html" ONCLICK="window.open('computuererrors.htm',

    Not sure how you fix it but thats your problem


  • Registered Users, Registered Users 2 Posts: 597 ✭✭✭yeraulone


    anchor tags might be the answer here - you know how to use them?


  • Registered Users, Registered Users 2 Posts: 3,890 ✭✭✭cgarvey


    Monkey wrote:
    How can I change this so that the original page does not reload?

    change ..
    <a href="index.html" ONCLICK="window.open('computuererrors.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=560,height=600')">
    
    .. to ..
    <a href="#" ONCLICK="window.open('computuererrors.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=560,height=600')">
    
    .. or ..
    <a href="javascript:window.open('computuererrors.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=560,height=600')">
    

    .. or even better, use a javascript function to tidy up your A HREF tags...
    ...
    <head>
      ...
      <script type="text/javascript">
      <!--
        function openWin( url, w, h ) {
          window.open("computuererrors.htm", "NewWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=" + w + ",height=" + h );
        }
      -->
      </script>
    <head>
    ...
    

    .. and then change your links to ..
    <a href="javascript:openWin( 'computuererrors.htm', 560, 600 );">
    

    .cg


  • Registered Users, Registered Users 2 Posts: 236 ✭✭richardo


    Monkey wrote:
    Hello I haven't much knowledge of web design but need some advice on a problem i have with a simple site. I have a page of thumbnails where links open in a new window but the orignal page reloads every time you click a link. How can I change this so that the original page does not reload?

    Link: http://www.p-art-icles.com/niall

    Your page is reloading because each link has a <a href="index.html" and-thr-rest>

    Probably the simplest answer is to apply your Javascript code to the IMG tag and leave out the link altogether...

    Old code:
    <div align="center"><a href="index.html" ONCLICK="window.open('bookmarks.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=520,height=430')"><img src="bookmarksthumb.jpg" width="190" align="baseline" border="0" height="143"></a></div>

    New code:
    <div align="center"><img src="bookmarksthumb.jpg" width="190" align="baseline" border="0" height="143" ONCLICK="window.open('bookmarks.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=520,height=430')"></div>


  • Registered Users, Registered Users 2 Posts: 1,268 ✭✭✭hostyle


    cgarvey wrote:
    <a href="javascript:window.open('computuererrors.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=560,height=600')">
    

    Why? Try visiting such a link with links or lynx. I'd also be interested to see how well search spiders pick up javascript: links.

    Use href="#" and a unique id. Then use a javascript onload to hijack the onlick event for that id.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,268 ✭✭✭hostyle


    richardo wrote:
    Your page is reloading because each link has a <a href="index.html" and-thr-rest>

    Then add a "return false" to the end of the javascript call.


  • Registered Users, Registered Users 2 Posts: 21,278 ✭✭✭✭Eoin


    If you don't mind the toolbars etc on the new window, just use a normal link:
    <a href="page.html" target="_blank"><img src="img.gif"></a>
    


  • Registered Users, Registered Users 2 Posts: 3,890 ✭✭✭cgarvey


    hostyle wrote:
    Why? Try visiting such a link with links or lynx. I'd also be interested to see how well search spiders pick up javascript: links.

    I think it's reasonable to assume that the target audience is neither links or lynx. Images and Popups are not 2 features that either handle particularly well.

    I also think the SEO of his images (not his website content) is not of primary concern.

    Based on his post, and his website.

    .cg


Advertisement