SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot xiaawan's Avatar
    Join Date
    Sep 2007
    Location
    Islamabad, Pakistan
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    displaying selected checkbox within a div

    HI All,
    I have coded an interface that allows user to search based on their selected criteria. When this page is loaded for the first time none of the check boxes selected. Next time when user comes to this page, those check boxes are preselected that he used last time, and the values are coming from cookies. My problem is that if user selected any option that is away down, then he will not be able to see which one selected, Is it possible I can display which one is selected? I have attached an image that describes what I needed. Anything that can be coded in JavaScript HTML to make it possible, for me its almost impossible. Thanks in advance. Here is my sample code.

    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Div with checkboxes</title>
    <meta name="Author" content="Ilkka Huotari" />
    <style type="text/css">
    #container
    {
    	border:1px solid #7F9DB9;
    	height:100px;
    	width:200px;
    	overflow:auto;
    	margin:auto;
    }
    div label
    {
    	width:180px;
    	float:left;
    	font-family:Verdana, Arial, Helvetica, sans-serif;
    	font-size:12px;
    	padding:1px;
    	padding-right:0;
    	overflow:hidden;
    }
    div input
    {
    	padding:0;
    	padding-top:5px;
    }
    </style>
    </head>
    <body>
    <div id="container">
    <label for="test1"><input type="checkbox" id="test1" name="test1" />Test 1</label>
    <label for="test2"><input type="checkbox" id="test2" name="test2" />Test 2</label>
    <label for="test3"><input type="checkbox" id="test3" name="test3" />Test 3</label>
    <label for="test4"><input type="checkbox" id="test4" name="test4" />Test 4</label>
    <label for="test5"><input type="checkbox" id="test5" name="test5" />Test 5</label>
    <label for="test6"><input type="checkbox" id="test6" name="test6" />Test 6</label>
    <label for="test7"><input type="checkbox" id="test7" name="test7" />Test 7</label>
    <label for="test8"><input type="checkbox" id="test8" name="test8" />Test 8</label>
    <label for="test9"><input type="checkbox" id="test9" name="test9" />Test 9</label>
    <label for="test10"><input type="checkbox" id="test10" name="test10" />Test 10</label>
    </div>
    </body>
    </html>
    Attached Images Attached Images
    Zia Awan

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Set an offsetTop (or similar) on the contents of the div to force the scrolling?
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Zealot xiaawan's Avatar
    Join Date
    Sep 2007
    Location
    Islamabad, Pakistan
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Ian thank you very much for your reply. But I am not sure how to force scrolling. Could you please explain a bit more or any link that may help me. Thanks in advance.
    Zia Awan

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Zealot xiaawan's Avatar
    Join Date
    Sep 2007
    Location
    Islamabad, Pakistan
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Anderson, thank you very much for your help. At last I got the solution.
    I positioned my container div as absolute and then I got the offsettop of my label then force the container div scrolltop to the offsettop of the label and it's working fine in IE6,IE7, FF NN. Again thank you very much for your help. See you in any other post. Have a nice Time..............
    Zia Awan


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
  •