open in the same window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michal Adamski

    #1

    open in the same window

    I'm trying to make a popup. The code I pasted below works, but my problem
    is, that I want the http://www.mypage.com to open in the same browser
    window. So I need something instead of window.open(). Window.location shows
    the content of http://www.mypage.com when is called like this inside the
    body
    <script language="javas cript">

    window.location = http://www.mypage.com;
    </script>

    But when it is called in the way presented below, doesn't want to work. I
    need to call the function opening the window. I don't want to have the link
    in href to prevent some crawlers to follow the link.




    <html>
    <head>
    </head>
    <script language="javas cript">
    function gotoLink(url){
    window.open(url ,'');
    <!-- window.location = url; -->

    }
    </script>
    <body>
    <script>

    </script>

    <a href="javascrip t:void(0)" onClick="gotoLi nk('http://www.mypage.com' );">
    <img src ="ad.jpg" border=no ></a>
    </body>
    </html>



    thanks
    Michal


  • Lee

    #2
    Re: open in the same window

    Michal Adamski said:
    [color=blue]
    >But when it is called in the way presented below, doesn't want to work. I
    >need to call the function opening the window. I don't want to have the link
    >in href to prevent some crawlers to follow the link.[/color]
    [color=blue]
    ><a href="javascrip t:void(0)" onClick="gotoLi nk('http://www.mypage.com' );">[/color]

    If you don't want the link in the HREF to be followed, your
    onclick handler should return false. In this case, the link
    in your HREF says to stay on the current page.

    onclick="gotoLi nk('http://www.mypage.com' );return false"

    Comment

    Working...