Results 1 to 2 of 2

Thread: Tabbed Document Viewer

  1. #1
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tabbed Document Viewer

    How can i run this script using an image as the tab. can anyone help???


    <html>
    <head>
    <style type="text/css">

    /*Eric Meyer's based CSS tab*/

    #tablist{
    padding: 3px 0;
    margin-left: 0;
    margin-bottom: 0;
    margin-top: 0.1em;
    font: bold 12px Verdana;
    }

    #tablist li{
    list-style: none;
    display: inline;
    margin: 0;
    }

    #tablist li a{
    text-decoration: none;
    padding: 3px 0.5em;
    margin-left: 3px;
    border: 1px solid #778;
    border-bottom: none;
    background: white;
    }

    #tablist li a:link, #tablist li a:visited{
    color: navy;
    }

    #tablist li a:hover{
    color: #000000;
    background: #C1C1FF;
    border-color: #227;
    }

    #tablist li a.current{
    background: lightyellow;
    }

    </style>

    <script type="text/javascript">

    /***********************************************
    * Tabbed Document Viewer script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    var selectedtablink=""
    var tcischecked=false

    function handlelink(aobject){
    selectedtablink=aobject.href
    tcischecked=(document.tabcontrol && document.tabcontrol.tabcheck.checked)? true : false
    if (document.getElementById && !tcischecked){
    var tabobj=document.getElementById("tablist")
    var tabobjlinks=tabobj.getElementsByTagName("A")
    for (i=0; i<tabobjlinks.length; i++)
    tabobjlinks[i].className=""
    aobject.className="current"
    document.getElementById("tabiframe").src=selectedtablink
    return false
    }
    else
    return true
    }

    function handleview(){
    tcischecked=document.tabcontrol.tabcheck.checked
    if (document.getElementById && tcischecked){
    if (selectedtablink!="")
    window.location=selectedtablink
    }
    }

    </script>
    </head>

    <body>

    <ul id="tablist">
    <li><a class="current" href="http://www.google.com" onClick="return handlelink(this)">Google</a></li>
    <li><a href="http://www.yahoo.com" onClick="return handlelink(this)">Yahoo</a></li>
    <li><a href="http://www.msn.com" onClick="return handlelink(this)">MSN</a></li>
    <li><a href="http://www.news.com" onClick="return handlelink(this)">News.com</a></li>
    <li><a href="http://www.dynamicdrive.com" onClick="return handlelink(this)">Dynamic Drive</a></li>
    </ul>
    <iframe id="tabiframe" src="http://www.google.com" width="98%" height="350px"></iframe>

    <form name="tabcontrol" style="margin-top:0">
    <input name="tabcheck" type="checkbox" onClick="handleview()"> Open tab links in browser window instead.
    </form>

    </body>
    </html>

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.

Bookmarks

Posting Permissions

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