473,387 Members | 1,904 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,387 software developers and data experts.

Trouble with <OBJECT>

Hi there.

OK, this is a little bit complicated.
I would live to find a different way to do this, but evidentially I am not able
to open a Text-File in JAVASCRIPT and fill an Array with the Values, so I have
to do it this way.

I am doing the following:

I use a File called "ApplicationResources.properties" containing 2 columns
"message" & "content" with a FieldDelim "=".
This File contains Values for Labels in different Languages, so I can change
the Language always depending on the Browser-Language.
I have one for every language. (ApplicationResources.properties for English,
ApplicationResources_de.properties for German ...)

I have a an Object looking like this:

<OBJECT id="ApplicationResources"
classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
<PARAM name="DataURL" value="properties/ApplicationResources.properties">
<PARAM name="UseHeader" value="true">
<PARAM name="FieldDelim" value="=">
<PARAM name="Filter" value="">
</OBJECT>

I do change the value for the "DataURL" always depending on the
Browser-Language.

document.getElementById("ApplicationResources").ob ject.DataURL =
"ApplicationResources" + strBrowerLang + ".properties";
document.getElementById("ApplicationResources").Re set();

I use this Object, to read the Data from the Recordset in changing the Filter
by using the following function:

function BeanMessage(strMessage) {
document.getElementById("ApplicationResources").ob ject.Filter = "message=" +
strMessage;
document.getElementById("ApplicationResources").Re set();
strValue =
document.getElementById("ApplicationResources").re cordset.Fields("content"
).value;

return (strValue);
}

Within my BODY I use this for example:

<P>
<SCRIPT
type="text/javascript">document.write(BeanMessage("start.expl ain.1"));</SC
RIPT><BR>
<SCRIPT
type="text/javascript">document.write(BeanMessage("start.expl ain.2"));</SC
RIPT><BR>
<SCRIPT
type="text/javascript">document.write(BeanMessage("start.expl ain.3"));</SC
RIPT><BR>
</P>

This works perfectly fine when using the site locally on my computer, but as
soon as I try to work from the WebServer it doesn't anymore.
I get en error-message within the function "BeanMessage" >>Item in Collection
not found<<. After closing the Alert no more problems.
When building a try-Block into the function "BeanMessage" returning a Value
like "not-found" when try runs into an error, nothing will be found.

It looks like when using this on a WebServer the Object isn't populated yet ...
why?

Can anyone help me, why the Object isn't populated yet?
It seems to be populated after an Error-Message-Window.
Or, even better can tell me an easier way to do this ... and please I don't
want to create all Sites in different Languages, one change means changes in
several websites ...

Jay.

Jul 20 '05 #1
3 1599
Hi,

JayBrahms wrote:
Hi there.

OK, this is a little bit complicated.
I would live to find a different way to do this, but evidentially I am not able
to open a Text-File in JAVASCRIPT and fill an Array with the Values, so I have
to do it this way.

I am doing the following:
<snip>
Within my BODY I use this for example:

<P>
<SCRIPT
type="text/javascript">document.write(BeanMessage("start.expl ain.1"));</SC
RIPT><BR>
<SCRIPT
type="text/javascript">document.write(BeanMessage("start.expl ain.2"));</SC
RIPT><BR>
<SCRIPT
type="text/javascript">document.write(BeanMessage("start.expl ain.3"));</SC
RIPT><BR>
</P>

This works perfectly fine when using the site locally on my computer, but as
soon as I try to work from the WebServer it doesn't anymore.
I get en error-message within the function "BeanMessage" >>Item in Collection
not found<<. After closing the Alert no more problems.
When building a try-Block into the function "BeanMessage" returning a Value
like "not-found" when try runs into an error, nothing will be found.

It looks like when using this on a WebServer the Object isn't populated yet ...
why?

Can anyone help me, why the Object isn't populated yet?
It seems to be populated after an Error-Message-Window.
Or, even better can tell me an easier way to do this ... and please I don't
want to create all Sites in different Languages, one change means changes in
several websites ...

Jay.


Probably because the OBJECT (a Java applet I guess) is not started when
the first call to document.write occurs. Loading the applet takes some
time. When locally, the applet gets loaded faster, and it's started
already when you call it first. When on a server, everything goes
slower, and the applet takes time to download. Note also that the ONLOAD
of the document gets called after the applet is loaded, but before it is
started.

The only way to synchronize your page and the applet is to use the
start() method of the applet to call some JavaScript, indicating that
it's ready to be used. This complicates of course the design of your
page, since using document.write becomes impossible...

You can see the following examples to get a better idea of hot to
achieve what you try to do:

<URL: http://www.galasoft-LB.ch/myjavascript/consulting/LiveConnect102>
<URL: http://www.galasoft-LB.ch/myjava/WebLoadFile/Demo/Demo.html>

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #2
In article <20***************************@mb-m06.aol.com>, ja*******@aol.com
(JayBrahms) writes:
Hi there.

OK, this is a little bit complicated.
I would live to find a different way to do this, but evidentially I am not
able to open a Text-File in JAVASCRIPT and fill an Array with the
Values, so I have to do it this way.


Simply change your text files to .js files, and load them with a src attribute
on the script tag. Then change your definitions in the .js file.

Instead of this:

message=content
error.0=The following Errors occurred during validation:
error.1=User has to be filled.
error.2=Password has to be filled.
error.3=User does not exist.
error.4=There are no shared Albums available for this User.

Something like this:

var message="content"
var error = new Array()
error[0]="The following Errors occurred during validation:"
error[1]="User has to be filled."
error[2]="Password has to be filled."
error[3]="User does not exist."
error[4]="There are no shared Albums available for this User."

etc..
--
Randy
Jul 20 '05 #3
Hi,

HikksNotAtHome wrote:
Simply change your text files to .js files, and load them with a src attribute
on the script tag. Then change your definitions in the .js file.

Instead of this:

message=content
error.0=The following Errors occurred during validation:
error.1=User has to be filled.
error.2=Password has to be filled.
error.3=User does not exist.
error.4=There are no shared Albums available for this User.

Something like this:

var message="content"
var error = new Array()
error[0]="The following Errors occurred during validation:"
error[1]="User has to be filled."
error[2]="Password has to be filled."
error[3]="User does not exist."
error[4]="There are no shared Albums available for this User."

etc..


While this will work in most cases, I'd like to note that this has the
disadvantage to sending the file (each file) to the user's PC. I can
imagine some cases where it is not wanted, either because some sensitive
information is included in the files (in which case the processing
should be done server-side anyway).

Just my 2 cents.

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #4

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

Similar topics

0
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
6
by: Christopher Benson-Manica | last post by:
(I posted this as a reply to my thread about iframes, but I think it may get mostly ignored there.) http://ataru.gomen.org/files/test.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"...
4
by: KC | last post by:
Could some one explain to me the casting rules for sending generic lists, ex. List<Person>, to a function that accepts List<object>? I cannot get the following easy-cheesy app to work. I get the...
1
by: easy.lin | last post by:
.... <object id="10">door</object> .... I try to write this in clipse XSD editor <element name="object" type="string"> <attribute name="id" type="int"></attribute> </element> but get wrong...
4
by: colson | last post by:
Hi, If I have a class A, and a List<List<object>> containing instances of A. How do I explicitly cast List<List<object>> as List<List<A>>?
4
by: msnews.microsoft.com | last post by:
hello every one i am using media player in internet explorer but i cannot access it directly in code behind, so do you know a way to access it? <object id="video123"...
4
by: Alan Silver | last post by:
Hello, I have an <objecttag that is used to display a Flash file. I would like the whole Flash file to be a link. The obvious thought would be to do this... <a...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.