Auto click and new window

Discussion in 'JavaScript' started by dramiditis, Feb 17, 2009.

  1. #1
    Hi,

    I would like to set auto clickable link and to open new window. My code so far is:

    <script type="text/javascript">
    
    function init(){
    
    var linkPage = document.getElementById('dynLink').href;
    parent.location.href = linkPage;
    }
    
    onload=init;
    
    </script>
    
    Code (markup):
    and my link:

    <a href="form.php?url=www.example.coml" id="dynLink" >new</a>";
    Code (markup):
    So, everything works just fine, but I want that link to open in new window. I have tried target="newWindow" and target="_blank", but doesn't work, still opens in same window.

    Any sugestions?
     
    dramiditis, Feb 17, 2009 IP
  2. websecrets

    websecrets Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    open a child window and child.location = yourlinkurl
     
    websecrets, Feb 17, 2009 IP
  3. dramiditis

    dramiditis Peon

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok, thanks
     
    dramiditis, Feb 17, 2009 IP