www.webdeveloper.com
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2012
    Posts
    11

    need help in finishing javascript program

    hi

    I am a total nitwit in javascript programming
    Nevertheless with 'copy and paste' and by using common sense javascript became a valuable part of my html websites

    I wrote a testprogram to prevent scrolling without clicking (problem for webstats). Pages are presented 1 by 1 by unhiding a div block
    see: http://paradigm-shift-21st-century.nl/test1.html

    So far I managed, but the remaining problem is that you need to unselect every page before selecting a next one.

    Has anyone a solution where selecting automatically means unslecting/unhidin the former page

    Thanks a lot in advance

    Henkt

    Please with example, because my javascript knowledge is very little

  2. #2
    Join Date
    May 2006
    Location
    Russia, Rostov-on-Don
    Posts
    1,151
    first of all, try to fix the CSS and HTML and then understand what did you mean with this line:

    Code:
    var link = document.getElementById("linkId1");
    use [code]YOUR CODE GOES HERE[/code] or burn in Hell

  3. #3
    Join Date
    Jun 2012
    Posts
    11

    Question Thanks Padonak

    Hello Padonak

    I'm sorry but your reaction wasn't really helpful

    I don't worry about 'correct' css, but my html i always check. Because that's what searchengines do too.
    No errors

    And the program works, though not satisfactorily. The result is not what I looked for.

    You might explain what you mean with your remark

    Henkt

  4. #4
    Join Date
    Jun 2012
    Posts
    11
    And the linkid is superfluous. I already noticed

  5. #5
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,550
    Code:
        function divToHide(divToHideOrShow) {
            var div = document.getElementById(divToHideOrShow);
            if (divToHide.lst&&divToHide.lst!=div){
             divToHide.lst.style.display = "none";
            }
            if (div.style.display == "block")
           {
                div.style.display = "none";
            }
            else
           {
                div.style.display = "block";
            }
          divToHide.lst=div;
        }
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org.uk
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  6. #6
    Join Date
    Jun 2012
    Posts
    11

    fabulous Vic

    Hi Vic

    It works

    I have to study to grasp why, but GREAT!

    Thanks a lot

  7. #7
    Join Date
    May 2006
    Location
    Russia, Rostov-on-Don
    Posts
    1,151
    Quote Originally Posted by henkt View Post
    ...
    I don't worry about 'correct' css, but my html i always check. Because that's what searchengines do too.
    No errors
    ...
    1. here is your page markup validation result - 9 Errors, 2 warning(s)

    2. if you don't worry about 'correct' css, be prepared to get many troubles with Javascript. just for your info, the CSS validator says that your stylesheet has at least 7 errors.
    use [code]YOUR CODE GOES HERE[/code] or burn in Hell

  8. #8
    Join Date
    Jun 2012
    Posts
    11

    Thread finished, Vic gave a correct answer

    Hi Padonak

    Keep focusing on the essence.

    I use html validator and saw 2 errors but not essential ones, caused by a forgotten <div> command. Nothing to worry about, as you surely noticed

    Henkt

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

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
HTML5 Development Center



Recent Articles