Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Location
    UK
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question is this possible??

    one of my clients wants to modify his site and make it a tableless layout which is fine by me..

    But,
    i'll briefly outline the layout structure and wat he wants..

    its going to be a 2 column layout..

    the left one will have the site navigation and other links.. and in the main content layout, there will some links pointing to various doc files and pdf's.

    now he wants all these pdf's docs to open in new windows.. but he does not want any "window.open" or any other js to be entered in the link tags..

    he wants all the links in the content div to be just plain links.. a href="1.pdf"
    and nothing else to be there..


    so, i want to find out is there is a way to do that in js..

    open the links in one div in a different way and the links in another div differently..

    any help or tip is greatly appreciated and is of great help..

    thanks..

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    <a href="my.pdf" target="_blank">

    ??

  • #3
    New to the CF scene
    Join Date
    Jun 2002
    Location
    UK
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    he doesnt want that ..

    all he says and sticks by what he wants is..

    <a href="1.pdf">1 pdf</a>

    tats all he wants ..

    s%^&£$$ bloke.. wouldnt listen to anything..

    he wants this and this only..

    else he says he will take the project somewhere, which is not good, cos i ave already managed to finish all the other things except this one..

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you really what to solve the problem ask him WHY he wants it.
    First, why he wants the links open in a new window? Does he realize that pop-up blockers may make the site appear broken?
    Second, what is wrong with adding target/scripting to the web page to accomplish the task?

    On the same token, there is nothing wrong to get paid for what you have already done and tell him to take his unreasonable demands elsewhere.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    pop up blockers shouldn't block windows opened with target blank.

    and here is the code to your weird man lol, his request makes no sense to me and if javascript is disabled it will load the pdf's in the main window.


    <html>
    <body>
    <div id="link" style="border:1px solid black">Link Div<a href="test1.html">test</a>
    <a href="test1.html">test</a>
    <a href="test1.html">test</a></div>
    <div id="main" style="border:1px solid black">Main Div<a href="test1.html">test</a>
    <a href="test1.html">test</a>
    <a href="test1.html">test</a></div>
    </body>
    </html>
    <script>
    var mainDivLinks=document.getElementById('main').getElementsByTagName('a');
    for(var i=0;i<mainDivLinks.length;i++)
    {
    mainDivLinks[i].target="_blank";
    }
    </script>

  • #6
    New to the CF scene
    Join Date
    Jun 2002
    Location
    UK
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks Garadon...

    now to finish off this weird site

  • #7
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If your weird guy only want pdf to be popped he could make this alteration to the loop

    for(var i=0;i<mainDivLinks.length;i++)
    {
    if(mainDivLinks[i].href.split('.')[mainDivLinks[i].href.split('.').length-1].toLowerCase()=='pdf')
    mainDivLinks[i].target="_blank";
    }

  • #8
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's not recommended but try using <BASE target="_blank"> in the head and collect your money and vow not to do any more work for such a stubborn fool.

  • #9
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    he couldn't do that since that would affect the other divs links to unless ofcourse he was allowed to write target on those.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •