+ Reply to Thread
Page 2 of 3
FirstFirst 1 2 3 LastLast
Results 11 to 20 of 23

Thread: web help

  1. #11
    Miss. Multimedia Artist StiligeCecilie's Avatar
    Join Date
    Jul 2008
    Location
    Bergen, Norway
    Posts
    4,121
    Quote Originally Posted by kneeto View Post
    im working on the site now, you wouldnt happen to have any working examples of the hidden div thing would you? just makes it easier if i could see the coded and stuff.

    cheers
    With W3Schools you can try out CSS examples:
    CSS Examples


  2. #12
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508
    to hide a div you will target the display or visibility properties with css:
    display uses "none" for hiding, and visibility uses "hidden"

    Inline
    HTML Code:
      <div style="display:none"></div>  or  <div style="visibility:hidden"></div>
    Separate
    HTML Code:
    </div> (html) (linked css file) .contentBox1 { font:normal 8pt Arial; color:#000; width:350px; text-align:justify; display:none; }
    Using an external css doc and linking it in the HEAD of the page is a better route.
    HTML Code:
    <link href="locationOfCssFile" rel="stylesheet" />
    Last edited by graphicsAZ; 01-06-2009 at 03:24 PM. Reason: error with html tags in quick reply post
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  3. #13
    likes chips. Scriptage's Avatar
    Join Date
    May 2008
    Location
    Yorkshire
    Posts
    2,754
    That doesn't achieve the same effect at all, using CSS you would need to use Javascript to show / hide divs without reloading the page. If you must use frames use the XHTML 1.0 Frameset doctype, there's a simple primer here: DevGuru XHTML Tag: frameset.

  4. #14
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508
    That doesn't achieve the same effect at all...
    That was to simply hide an object with CSS. I agree, if you want to toggle the visibility it would take javascript as well.

    Kneeto here is a working example:
    (maybe someone could write it better, but this works)

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Toggle Visibility</title>
    <script type="text/javascript">
    function toggleDiv(num) {
        var obj = document.getElementById('div' + num);
        if (obj.style.display == ''){
        obj.style.display =  'none';
        } else {
        obj.style.display =  '';
        }
    }
    </script>
    <style type="text/css">
    .btn {
    font: bold 10pt Arial;
    color:#0099FF;
    text-decoration:none;
    }
    .btn:hover
    {
    font: bold 10pt Arial;
    color:#0066FF;
    text-decoration:underline;
    cursor:pointer;
    }
    a{
    font: bold 10pt Arial;
    color:#0099FF;
    text-decoration:none;
    }
    a:hover{
    font: bold 10pt Arial;
    color:#0066FF;
    text-decoration:underline;
    }
    .cntDiv
    {
    width:200px;
    height:200px;
    background-color:#0033CC;
    color:#fff;
    padding:10px;
    }
    </style>
    </head>
    <body>
    <div class="btn" onclick="javascript:toggleDiv(1)">Toggle 1</div> <!-- Div acting as a Link -->
    <a href="javascript:toggleDiv(1)" class="btn">Toggle 2</a> <!-- Standard Link -->
    <div id="div1" class="cntDiv">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse aliquam cursus vehicula. </div>
    </body>
    </html>
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  5. #15
    likes chips. Scriptage's Avatar
    Join Date
    May 2008
    Location
    Yorkshire
    Posts
    2,754
    That's inaccessible, if someone has Javascript disabled they won't be able to see the content, I'd use AJAX:

    HTML Code:
    <!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>JS</title>
    <style type="text/css">
    
    #left{
    float:left;
    width: 150px;
    height: 600px;
    }
    
    #right{
    float:left;
    width: 550px;
    height: 600px;
    }
    
    </style>
    <script type="text/javascript">
    /* <![CDATA[ */
    function GetRequestObject(){
       var XMLHttp;
       /*@cc_on
        @if (@_jscript_version >= 5)
        try {
          XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
          try {
            XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e) {
            XMLHttp = false;
          }
        }
       @else
       XMLHttp = false;
       @end @*/
       if (!XMLHttp && typeof XMLHttpRequest != 'undefined') {
        try {
          XMLHttp = new XMLHttpRequest();
        } catch (e) {
          XMLHttp = false;
        }
       }
       return XMLHttp;
    }
     
    function GetPage(linkObj){
       Request = GetRequestObject();
       if(!Request){
       window.location.href = linkObj.href;
       }
       Request.open("GET", linkObj.href ,true);
     
       Request.onreadystatechange = function(){
       if(Request.readystate == 4 || Request.readyState == 4){ // Successfully sent
       var File = Request.responseText.substring(Request.responseText.indexOf('<body>'), Request.responseText.indexOf('</body>')+7);    
       document.getElementById("right").innerHTML = File;
     
       }
       };
     
    Request.send(null);
     
     
    }
    /* ]]> */
    </script>
    </head>
    <body>
    <div id="left">
    <a href="one.html" onclick="GetPage(this); return false;">One</a>
    
    <a href="two.html" onclick="GetPage(this); return false;">Two</a>
    </div>
    <div id="right">
    </div>
    </body>
    </html>
    Of course it would be better to create a template file, seperate the JS into a seperate file and use an XML object and parser to target the content ("right") div but that's for another discussion.

  6. #16
    CSS Wizardry Harry's Avatar
    Join Date
    May 2007
    Location
    Leeds, England
    Posts
    13,879

  7. #17
    Established Member graphicsAZ's Avatar
    Join Date
    Oct 2008
    Location
    Arizona, USA
    Posts
    508
    Quote Originally Posted by PR Design View Post
    :hmm:
    John Darling - Graphic & Web Designer
    SmarterTools Inc. | (877) 357-6278 | www.smartertools.com

  8. #18
    CSS Wizardry Harry's Avatar
    Join Date
    May 2007
    Location
    Leeds, England
    Posts
    13,879
    I'm laughing at the fact that Scriptage knows everything, and over-delivers, as usual.

  9. #19
    likes chips. Scriptage's Avatar
    Join Date
    May 2008
    Location
    Yorkshire
    Posts
    2,754
    Easy, accessible, AJAX. for a more advanced and easy to use implementation

  10. #20
    Junior Member
    Join Date
    Apr 2009
    Posts
    18
    thanks for the responses guys, im just waiting to pay for webhosting, then the site should be up withing a couple of days. ill try using the ajax method. nudes otw ;p

+ Reply to Thread
Page 2 of 3
FirstFirst 1 2 3 LastLast

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


The Graphics Forum Web Design Stuff Free Decent Downloads Free Quality Wallpapers Graphics Forum Free Vista Themes
The Top The Best Images Tech Talk 247 Logo Design - $149 Affordable Stock Vector Illustrations Creativecurio - Design Blog Graphic Design Advertising

Check the forum often for the latest design announcements. Everything from graphic design and web design, to films and music. Estetica is a great place for people to get together and help each other out.



Web Hosting - UK Web Hosting services for business or personal website hosting needs.

Dedicated Servers - A full range of Managed Dedicated Server solutions suitable for all your requirements.

Graphic Design Blog | Web Design Forum | Graphic Design and Print Forum | Graphic Design Links | Advertise On This Site

Web Design UK | Vision.To Design | Leaflet Printing | Estetica Design Forum's Privacy Policy

Flyer Printing | Photography Blog | Design Forum Links | Logo Design | Graphic Design Social Network | Logo Design

Graphic Design Tutorials | Logo Designer | UK Logo Design Studio | Land for sale | Vector Art Blog | Leaflet Printing

Free Web Hosting | Custom Logo Design - $149 Only | Affordable Print Design Templates | Small Business Logo Design | Company Logo Design

Logo Design Service | Logo Design Firm | Logo Design Reseller | Custom Logo Design | Letterhead Printing | Flyer Printing | Business Card Printing

Printing | Leaflet Printing | Online Backup | T-Shirt Printing | Personalised Mugs | Canvas Printing | Free Web Hosting Comparison Site