Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Opening new windows

Options
  • 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 Posts: 35,524 ✭✭✭✭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 Posts: 597 ✭✭✭yeraulone


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


  • Registered Users Posts: 3,886 ✭✭✭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 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 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 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 Posts: 21,257 ✭✭✭✭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 Posts: 3,886 ✭✭✭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