show layer onload

Discussion in 'Javascript' started by BGT, Jan 23, 2005.

  1. BGT

    BGT Guest

    Hi

    I have some layers, at the same position.
    I want to show one of them according to the system language,
    and I have made this so far:

    function showit() {
    if (lang == "da") document.da.visibility="show"
    if (lang == "de") document.de.visibility="show"
    if (lang == "it") document.it.visibility="show"
    if (lang == "fr") document.fr.visibility="show"
    .................

    <div class="box" id="da" style="visibility: hidden; position:
    absolute; top: 1500px; align: center;">
    <div class="box" id="de" style="visibility: hidden; position:
    absolute; top: 1500px; align: center;">
    ..... and so on .......

    body onload showit()

    But it get: 'document.da' is null or not an object

    What do I do wrong ?
    BGT, Jan 23, 2005
    #1
    1. Advertising

  2. BGT

    Randy Webb Guest

    BGT wrote:

    > Hi
    >
    > I have some layers, at the same position.
    > I want to show one of them according to the system language,


    How are you determining system language?

    > and I have made this so far:
    >
    > function showit() {
    > if (lang == "da") document.da.visibility="show"
    > if (lang == "de") document.de.visibility="show"
    > if (lang == "it") document.it.visibility="show"
    > if (lang == "fr") document.fr.visibility="show"
    > .................




    document.getElementById('da').style.visibility = "visible";
    And, where is lang defined?

    > <div class="box" id="da" style="visibility: hidden; position:
    > absolute; top: 1500px; align: center;">
    > <div class="box" id="de" style="visibility: hidden; position:
    > absolute; top: 1500px; align: center;">
    > ..... and so on .......


    If your visitors have JS disabled, they will see nothing. This whole
    project is better suited to be done on the server, or, to have static
    links on an intro page to each language page.

    > body onload showit()
    >
    > But it get: 'document.da' is null or not an object


    What browser?

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq
    Randy Webb, Jan 24, 2005
    #2
    1. Advertising

  3. BGT

    Richard Guest

    Then why are we here discussing javascript at all if a very small percentage
    of users have it turned off?

    Have we not heard of "MAJORITY RULES"?
    I've seen a vast majority of sites using some form of JS.

    If you were to go to the country of Greece, you would expect everyone there
    to know and understand English.

    Why can't you just assist someone without the negativism all the time?
    Richard, Jan 24, 2005
    #3
  4. BGT

    BGT Guest

    On Sun, 23 Jan 2005 19:48:52 -0500, Randy Webb
    <> wrote:

    > > I want to show one of them according to the system language,

    >
    > How are you determining system language?

    that is no problem, works perfect on all other pages.

    > document.getElementById('da').style.visibility = "visible";
    > And, where is lang defined?

    lang is defined in another extern script.

    > If your visitors have JS disabled, they will see nothing. This whole
    > project is better suited to be done on the server, or, to have static
    > links on an intro page to each language page.

    Less than 1% of my visitors has js disabled,
    if js was a problem this group would probably not exist :)

    > > But it get: 'document.da' is null or not an object

    > What browser?

    IE6
    BGT, Jan 24, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YzY3NjIyOA==?=

    do it in database layer or application layer

    =?Utf-8?B?YzY3NjIyOA==?=, Jan 26, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    424
    Karl Seguin [MVP]
    Jan 27, 2006
  2. et
    Replies:
    2
    Views:
    1,896
  3. dan
    Replies:
    25
    Views:
    1,322
    Uncle Bob (Robert C. Martin)
    Oct 28, 2003
  4. Universe
    Replies:
    1
    Views:
    470
    Universe
    Oct 24, 2003
  5. Dhananjay
    Replies:
    1
    Views:
    1,098
    sloan
    Dec 18, 2006
Loading...

Share This Page