Hello everyone!! Can I get some coding help here?

Discussion in 'JavaScript' started by id4382, Jan 31, 2008.

  1. #1
    Ok, so here is what i want to do, I will admit, I am a beginner at javascript so please go easy on me. I am wanting a javascript that will hide based off of what result is returned by another javascript. Here are the code snippets:

    GEOCity:

    Text Hide:



    The two codes seperately work fine right at this moment. What I want to be able to do, is set a restriction that the the 'Text Hide' code will only run IF a certain City is returned by the 'GEOCity' code. If anyone could help me on this I would be a great help!!!
     
    id4382, Jan 31, 2008 IP
  2. mnn888

    mnn888 Member

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    <script type="text/javascript" language="Javascript">

    if( geoip_city() == "Certain City"){
    HideText();
    }

    function HideText(){
    var list = document.getElementsByTagName("font");
    for (var i=0; i < list.length; i++) {
    if (list.innerHTML.indexOf("Members Price:") > -1) {
    list[i++].style.display="none";
    if (list.innerHTML.indexOf("$") > -1) list.style.display="none";
    }
    }
    }
    //-->
    </script>
     
    mnn888, Jan 31, 2008 IP
  3. id4382

    id4382 Peon

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Mnn, I pasted the code and have ran a few tests, and it is working great! To include additional cities, all I need is to add with a comma to seperate? Or is there an additional arrangement of code to tell it to watch for others?
     
    id4382, Jan 31, 2008 IP
  4. mnn888

    mnn888 Member

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #4
    to include additional cities:
    var city = geoip_city() ;
    if( city == "Certain City" || city == "Certain City2" || city == "Certain City3"){
    HideText();
    }
     
    mnn888, Feb 1, 2008 IP