In the following function:
function showMenu(theMenu, theAction) {
if (document.getElementById)
{document.getElementById(theMenu).style.visibility = theAction;}
else {if (document.layers) {document.theMenu.visibility = theAction;}
else {document.all.theMenu.style.visibility = theAction;}}
}
Will the passed value of theMenu be substituted in the last 2 lines or
will it use "theMenu" as the value?
The following words are in the last line:
document
all
theMenu
style
visibility
Since all are reserved words except for "theMenu" is that term
changable?
Do I have to use the following:
eval("document.all."+theMenu+".style.visibility")
I have no way to test it.
--
Dennis Marks http://www.dcs-chico.com/~denmarks/
To reply change none to dcsi.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =----- 8 5313
"Dennis Marks" asked In the following function:
function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document.theMenu.visibility = theAction;} else {document.all.theMenu.style.visibility = theAction;}} }
Will the passed value of theMenu be substituted in the last 2 lines or will it use "theMenu" as the value?
The latter.
Do I have to use the following: eval("document.all."+theMenu+".style.visibility")
No. Try document.all[theMenu].style.etc.
with square brackets, no eval and no quotes.
HTH
Ivo
Dennis Marks <de******@none.net> writes: In the following function:
function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document.theMenu.visibility = theAction;} else {document.all.theMenu.style.visibility = theAction;}} }
Will the passed value of theMenu be substituted in the last 2 lines or will it use "theMenu" as the value?
It will use the literal text "theMenu", since you are not writing a
variable. The following words are in the last line: document all theMenu style visibility
Since all are reserved words except for "theMenu" is that term changable?
None of the words are reserved in the Javascript language. The reserved
words are at the end of this page:
<URL:http://www.crockford.com/javascript/survey.html>
(Hmm, of the six ways a reserved word can't be used, I think the first
should be "As an *unquoted* name in linteral object notation")
The identifiers have the following meaning:
- The variable "document" refers to the variable of that name. This is
usually the global variable, i.e., a property of the global object with
that name. The value of the variable is used.
- The identifier "all" is used as part of a property accessor (due to
the "."), and is not interpreted as a variable. The name of the
identifier is used. The document object of some browsers has a
property called "all", so you find that.
- The identifier "theMenu" is used as part of a property accessor (due
to the "."), and is not interpreted as a variable. The name of the
identifier is used. The object referenced by "document.all" may, or
may not, have a property of that name.
etc.
Do I have to use the following: eval("document.all."+theMenu+".style.visibility")
Never. Never use eval, you don't need it, and the alternatives are
both safer and more efficient.
<URL:http://jibbering.com/faq/#FAQ4_40>
Use:
document.all[theMenu].style.visibility
<URL:http://jibbering.com/faq/#FAQ4_39>
In this notation, the part inside the [...] is an *expression*. In
this case it is a expression consisting of a single variable, but
it will be evaluated and its value used, not its name.
I have no way to test it.
No browser at all?
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
In article <n0**********@hotpop.com>, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote: Dennis Marks <de******@none.net> writes:
In the following function:
function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document.theMenu.visibility = theAction;} else {document.all.theMenu.style.visibility = theAction;}} }
Will the passed value of theMenu be substituted in the last 2 lines or will it use "theMenu" as the value?
<snip>
Use: document.all[theMenu].style.visibility <URL:http://jibbering.com/faq/#FAQ4_39>
In this notation, the part inside the [...] is an *expression*. In this case it is a expression consisting of a single variable, but it will be evaluated and its value used, not its name.
I have no way to test it.
No browser at all?
In my browsers only the statement immediately after the "if" is run.
The "else" portions are for other browsers. At least that is my
understanding. Please inform me if I am incorrect. I would like to
simplify it if possible.
The revised function is:
function showMenu(theMenu, theAction) {
if (document.getElementById)
{document.getElementById(theMenu).style.visibility = theAction;}
else {if (document.layers) {document[theMenu].visibility =
theAction;}
else {document[theMenu].style.visibility = theAction;}}
}
--
Dennis Marks http://www.dcs-chico.com/~denmarks/
To reply change none to dcsi.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
In article <12*************************@none.net>,
Dennis Marks <de******@none.net> wrote: In my browsers only the statement immediately after the "if" is run. The "else" portions are for other browsers. At least that is my understanding. Please inform me if I am incorrect. I would like to simplify it if possible.
The revised function is:
function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document[theMenu].visibility = theAction;} else {document[theMenu].style.visibility = theAction;}} }
You could look in a public library for some books on IE with a cd-rom in
them. Look for IE 4.5.
You could comment out the code for newer browsers and let the new IE run
with the old code.
Robert
Dennis Marks <de******@none.net> writes:
Dennis Marks <de******@none.net> writes: In my browsers only the statement immediately after the "if" is run.
Then get some more browsers!
Netscape 2 (JavaScript 1.0):
Netscape 3 (JavaScript 1.1):
Netscape 4.00-4.05 (JavaScript 1.2):
Netscape 4.06-4.80 (JavaScript 1.3):
Netscape 7 (JavaScript 1.4):
<URL:http://wp.netscape.com/download/archive.html>
Mozilla FireFox (same engine as Netscape 7, just more recent version):
<URL:http://www.mozilla.org/products/firefox/>
IE 3 (JScript 1.0):
IE 4 (JScript 3.0):
IE 5.01 (JScript 5.0):
IE 5.5 (JScript 5.5):
<URL:http://www.quirksmode.org/browsers/multipleie.html>
Opera v. 3.62, 5.12, 6.06, 7.11 (soon 7.23):
<URL: http://arc.opera.com/pub/opera/win/ >
Opera 7.5:
<URL: http://www.opera.com/download/ >
(I have a version 4 too, if you want it)
Earlier verions of these browsers didn't support Javascript.
If that's not enough, here is the rest:
<URL:http://browsers.evolt.org/>
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
"Dennis Marks" wrote In my browsers only the statement immediately after the "if" is run. The "else" portions are for other browsers. At least that is my understanding. Please inform me if I am incorrect. I would like to simplify it if possible.
The revised function is:
function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document[theMenu].visibility = theAction;} else {document[theMenu].style.visibility = theAction;}} }
There are two brackets too many in this function. The one just before "if
(document.layers)" and the last one should be removed. Currently the logic
looks like:
if (foo) { x=1; } else { if (bar) x=2; } else { x=3; }
which is not logical. I suspect you meant:
if (foo) { x=1; } else if (bar) { x=2; } else{ x=3; }
If you don't have all the browsers you aim to support, there is little in
scripting for them. Even the best need to test. To test stuff for older
browsers, you can usually turn the "if" around (temporarily) with a ! in the
right place.
HTH
Ivo
In article <pt**********@hotpop.com>, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote: Dennis Marks <de******@none.net> writes: Dennis Marks <de******@none.net> writes:
In my browsers only the statement immediately after the "if" is run.
Then get some more browsers!
Netscape 2 (JavaScript 1.0): Netscape 3 (JavaScript 1.1): Netscape 4.00-4.05 (JavaScript 1.2): Netscape 4.06-4.80 (JavaScript 1.3): Netscape 7 (JavaScript 1.4): <URL:http://wp.netscape.com/download/archive.html> Mozilla FireFox (same engine as Netscape 7, just more recent version): <URL:http://www.mozilla.org/products/firefox/>
IE 3 (JScript 1.0): IE 4 (JScript 3.0): IE 5.01 (JScript 5.0): IE 5.5 (JScript 5.5): <URL:http://www.quirksmode.org/browsers/multipleie.html>
Opera v. 3.62, 5.12, 6.06, 7.11 (soon 7.23): <URL: http://arc.opera.com/pub/opera/win/ > Opera 7.5: <URL: http://www.opera.com/download/ > (I have a version 4 too, if you want it)
Earlier verions of these browsers didn't support Javascript.
If that's not enough, here is the rest: <URL:http://browsers.evolt.org/>
/L
Don't assume I am on a PC. I am on a Mac using system 9. I am not able
to use any of the latest browsers. They require system X and I don't
wish to invest in an upgrade since I might soon switch to a PC. That is
why I asked if the function was correct.
--
Dennis Marks http://www.dcs-chico.com/~denmarks/
To reply change none to dcsi.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
In article <40***********************@news.wanadoo.nl>, Ivo
<no@thank.you> wrote: "Dennis Marks" wrote In my browsers only the statement immediately after the "if" is run. The "else" portions are for other browsers. At least that is my understanding. Please inform me if I am incorrect. I would like to simplify it if possible.
The revised function is:
function showMenu(theMenu, theAction) { if (document.getElementById) {document.getElementById(theMenu).style.visibility = theAction;} else {if (document.layers) {document[theMenu].visibility = theAction;} else {document[theMenu].style.visibility = theAction;}} }
There are two brackets too many in this function. The one just before "if (document.layers)" and the last one should be removed. Currently the logic looks like:
if (foo) { x=1; } else { if (bar) x=2; } else { x=3; }
which is not logical. I suspect you meant:
if (foo) { x=1; } else if (bar) { x=2; } else{ x=3; }
If you don't have all the browsers you aim to support, there is little in scripting for them. Even the best need to test. To test stuff for older browsers, you can usually turn the "if" around (temporarily) with a ! in the right place. HTH Ivo
Thank you for your help. I am just creating a general division
show/hide function based on information that I have found in this
group.
I assume that the 3 methods used to show/hide are used by different
browsers. My browsers use getElementById.
The two forms of document{theMenu] do not work on my browsers. My
question is are they valid and are they necessary? I'll remove it if it
is only necessary for a few old browsers.
--
Dennis Marks http://www.dcs-chico.com/~denmarks/
To reply change none to dcsi.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =----- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: bofh |
last post by:
I'm working on a project where I need to store a CGI query in a
database field. The query contains variables which will be substitued
at runtime (e.g., today's date, key to select upon, etc), and...
|
by: Scott |
last post by:
I have an XML Document in a format like:
<Variable name="Bob">ABCDEFG</Variable>
<Variable name="Steve">QWERTYUI</Variable>
<Variable name="John">POIUYTR</Variable>
<Variable...
|
by: KERLOG |
last post by:
Hello,
I found that in "glibc" there is a function to perform variable
substitution.
It start with $.
By digging inside the code of "glibc" I can't find how it's done.
Has someone already...
|
by: Brian Newman |
last post by:
I have a form with five rows of text boxes, displaying data. For
certain reasons, I can't bind these directly to data records, so I'm
using code to load the data into an object, then manually get...
|
by: JoeT |
last post by:
Hi...
I want to know if this is possible.
I have a database with an attribute which has in it a SQL statement,
e.g.
select blah from table where key = $x
In a PHP function, I read in the...
|
by: Skip |
last post by:
OK, I'm a novice in JS but have lots of coding experience. I am
trying to accomplish something that would seem somewhat simple - BUT
IT'S NOT.
I have a basic window that calls another window...
|
by: damezumari |
last post by:
http://www.phpbuilder.net/columns/akent20000610.php3?page=5
variable:
function addtime ($datetime, $add, $type)
{
// How to add time to $datetime (data type datetime) and return it as...
|
by: brad |
last post by:
I'd like to do something like this:
var = '123'
%s = , %var
So that, in the end, var is '123' and an empty list is named '123' as
well. The list assignments are created during a loop.
...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |