Results 1 to 2 of 2

Thread: setting a style via document.getElementById not working

  1. #1
    Join Date
    Apr 2010
    Posts
    5

    setting a style via document.getElementById not working

    Here is the code:

    http://www.gridlocate.ca

    If you change the 'Meridian' to '4' and hit the 'Locate' button the map does it's magic and the updatelegend function gets called. I know it does because if I uncomment the alert test call the proper twn value gets displayed.

    The idea is that the style of the corresponding section & township squares on the sidebar are updated. If I manually enter the inputs along the way the style gets updated. Now that I think about it the issue must be with the input data. Perhaps I need to change the variable type??

    Dan

    function updatelegend(twn,sec) {

    // echo twn;

    // alert(twn);
    var twn = 't' + twn;
    var sec = 's' + sec;

    // alert(twn);

    document.getElementById(twn).style.borderWidth = "2px";
    document.getElementById(twn).style.borderColor = "blue";

    document.getElementById(sec).style.borderWidth = "2px";
    document.getElementById(sec).style.borderColor = "red";


    }

  2. #2
    Join Date
    Apr 2010
    Posts
    5

    [SOLVED] setting a style via document.getElementById not working

    Stupid me... I had padded zeros in my pop-ups but not in my div id's.
    Dan :^)

Similar Threads

  1. Pixy style rollover buttons not working in Safari
    By f7digitaldesign in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 29 Nov 2009, 07:10 PM

Posting Permissions

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