473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

show layer onload

BGT
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 ?

Jul 23 '05 #1
4 3756
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
Jul 23 '05 #2
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?
Jul 23 '05 #3
BGT
On Sun, 23 Jan 2005 19:48:52 -0500, Randy Webb
<Hi************@aol.com> 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

Jul 23 '05 #4
BGT wrote:
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 ?


A better way to do this would be to set a class on your body tag (or
another tag enclosing all of the language specific sections). So for
example, your HTML could contain:

<body class="language-en">

showit can modify the body class, and you then use css to control the
visibility of whatever sections you want:

function showit() {
document.body.className = "language-"+lang;
}

You may need to add some checking code if there is any chance lang is set
to something unexpected.

Also, you should move the position and alignment out of style attributes
and into a stylesheet.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Question | last post by:
I am making a custom small menu which is most basic. Problem is that I can't make the first step work for some reason. I have an image to the left of where would be the layer positioned. This...
1
by: PAD | last post by:
I have written a javascript routine that populates a parent document with a series of <iframe>s. Each <iframe> receives its contents from a series of separate smaller HTML files. Of course my NN...
1
by: Iver Erling Årva | last post by:
Hi! I wonder if anyone knows how to do this. I use layers in one of my html pages to simulate tabs like tabs in windows application. I have one layer per "page/tab" and call them...
6
by: news.versatel.de | last post by:
Hello NG, I am using javascript to open a new window like this: printpreview=window.open('printview.php','printprev','width=600,height=600'); The new window has a layer called preview: ...
4
by: anders | last post by:
I have a 'solution' with a Webservice, Business layer and a data layer. In the Business layer I've added a form that need to be started on the server(this site has full rights, runs with Local...
2
by: yuanh23 | last post by:
Hi, I have 3 talbes "customers","orders","details". i wanna to use 3 datagrids to show those tables. and when the selected row in parent talbe changes, the selected row in child table changes...
3
by: Merlin | last post by:
Hi there, I am trying to create a form with an dynamic field that can be shown or hidden. As I saw for example on google it is possible with JS to show a layer and move the content underneath...
2
by: lee | last post by:
Hello I need to hide a layer after a set time when the page loads. Let's say a 1000ms (a second). Now this works as you'd expect: <body onLoad="PopUp.style.visibility='hidden';">
3
by: Jim | last post by:
How can I use Javascript to show a layer named "callout" after the page has been delayed for 5 seconds? Using the onLoad behavior to execute a "Call Javascript" action. What is the correct...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.