A probable solution perhaps?

R

Richard

So sweet and simple.
Found this script on a board.

<script type="text/javascript">

function showtext(thetext) {
if (!document.getElementById) return false;
document.getElementById("toggle").innerHTML = thetext;
}
</script>


<a href="#" onClick="showtext('text A'); return false">link 1</a> <br>
<a href="#" onClick="showtext('text B'); return false">link 2</a>
<div id="toggle"></div>

Question is, can I replace ("textA") with a variable like (text[1]) ??
 
R

Richard

So sweet and simple.
Found this script on a board.
<script type="text/javascript">
function showtext(thetext) {
if (!document.getElementById) return false;
document.getElementById("toggle").innerHTML = thetext;
}
</script>

<a href="#" onClick="showtext('text A'); return false">link 1</a> <br>
<a href="#" onClick="showtext('text B'); return false">link 2</a>
<div id="toggle"></div>
Question is, can I replace ("textA") with a variable like (text[1]) ??


The answer is YES!
Works out so nicely I can now easily add descriptions with but a simple
array.
 
R

Richard

...and completely inaccessible.

I just tested it in IE6 and you are right, it does not work.
So maybe I'll find something that will work in both then.
I don't see why IE refuses it though.
 
M

Michael Winter

On Sat, 22 Jan 2005 19:27:29 GMT Michael Winter wrote:
[snip]
[...] completely inaccessible.

I just tested it in IE6 and you are right, it does not work.

Whether something "works" has nothing to do with its accessibility.

The fact that such an approach relies on a script to provide content
(completely unnecessarily, I might add) makes it unsuitable for the Web in
general as only scriptable browsers (that support innerHTML) can make
sense of the document.

[snip]

Mike
 
R

Richard

[snip]
[...] completely inaccessible.
I just tested it in IE6 and you are right, it does not work.
Whether something "works" has nothing to do with its accessibility.
The fact that such an approach relies on a script to provide content
(completely unnecessarily, I might add) makes it unsuitable for the Web
in
general as only scriptable browsers (that support innerHTML) can make
sense of the document.

Then why do we even have damn browsers if all they will do is render html?
The content presented in my case is not all that necessary, it is purely for
providing a short description of the image.
Of course, I could use a flaky tool tip thingy, but even that is crap.
I am looking at doing this in a bit more professional way.

During my surfing session today, I did run across one site which does
precisely what I want to do.
Where they had the main content swap in accordance with your choice from a
dropdown box.
But I couldn't figure out how they addressed the script page.
 
H

Hywel Jenkins

[...] completely inaccessible.
I just tested it in IE6 and you are right, it does not work.
Whether something "works" has nothing to do with its accessibility.
The fact that such an approach relies on a script to provide content
(completely unnecessarily, I might add) makes it unsuitable for the Web
in
general as only scriptable browsers (that support innerHTML) can make
sense of the document.

Then why do we even have damn browsers if all they will do is render html?

That's what browsers are for, Stupid.
The content presented in my case is not all that necessary
Agreed.


Of course, I could use a flaky tool tip thingy, but even that is crap.

You're used to producing crap aren't you, Bullis?

I am looking at doing this in a bit more professional way.

ROTFLMAO!
 
E

Evertjan.

Hywel Jenkins wrote on 23 jan 2005 in comp.lang.javascript:
That's what browsers are for, Stupid.

My IE6 happily shows a text-file, like <http://x.com/y.txt>

IE will also forward specific files to it's specialized programme,
like Realplayer, windowsmediaplayer, adobeviewer,
or plugins,
like flash, etc.

btw "rendering" [extract to,deliver to,depict as,translate into]
in the html sense is more a serverside code action IMHO.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Sat, 22 Jan 2005
So sweet and simple.
Found this script on a board.

You should have left it there.

function showtext(thetext) {
if (!document.getElementById) return false;
document.getElementById("toggle").innerHTML = thetext;
}

That function returns either false or undefined; that's not a well-
designed combination.

In reading recent articles in this newsgroup, you should have seen a
thread containing

if (document.all && !document.getElementById) {
document.getElementById = function(id) {
return document.all[id] } }

If that code is executed before showtext is called, showtext will work
equally well in older versions of MSIE, under reasonable assumptions
about "toggle".

For versatility, supply the location as a parameter to showtext.

The code can then be put in an include file, and used on various pages.
 
R

Richard Cornford

Richard said:
Michael Winter wrote:

Then why do we even have damn browsers if all they
will do is render html?

The minimum requirement for a web browser is that it be able to retrieve
an HTML document and (in some sense) present its contents to the user.
If it cannot do that then it is not a web browser, but if it does
anything more then that is an optional extra. Making accessing content
dependent upon optional technologies is a mistake, and a demonstrably
avoidable mistake at that.
The content presented in my case is not all that
necessary, it is purely for providing a short description
of the image.
Of course, I could use a flaky tool tip thingy, but even
that is crap.

Apparently that is not true as you have manifestly failed to
successfully implement even one of the copy-and-paste scripts that you
have been trying to use, and trying to adopt scripts that were not
designed for copy-and-paste (copyright issues not withstanding) was
never a viable activity as that will always require a real understanding
of browser scripting.
I am looking at doing this in a bit more professional way.

A professional presented with a problem outside of their skill-set will
either: 1. Acquire then necessary skills. 2. Hire the services of
another professional who already has those skills. Usually the latter as
the former is too time consuming to address most current problems (but
might still be seen as an appropriate course of action in anticipation
of similar problems occurring in the future).

What a professional will not do is spend two months spinning their
wheels looking for some sort of panacea script on the internet, the
implementation of which, if ever found, would be beyond them anyway.

One of the things that makes you intermittently posted, self satisfied
"progress" reports particularly unwelcome is that everyone reading them
knows that you are progressing from nothing, towards nothing. Your whole
approach is fatally flawed; you cannot successfully use scripting on the
Internet without first acquiring the pertinent skills, and you haven't
even grasped HTML yet let alone the added complexity of perceiving the
additional mechanism involved in scripting.
During my surfing session today, I did run across one
site which does precisely what I want to do.
Where they had the main content swap in accordance with
your choice from a dropdown box.

Yes, it is trivial to do it. The only significant issues are designing
the script so that it does not introduce unnecessary dependencies, and
is reliable in its execution or clean degradation.
But I couldn't figure out how they addressed the script page.

When conversing with people who have (at best) a slight understanding of
a technical subject throwing in a little tech-speek might impress. In
the context of a technical newsgroup the misuse of technical language
will only make it obvious that you don't know what you are talking
about, but are trying (for some unfathomable reason) to pretend
otherwise.

It is not "how they address the scripted page" that you could not figure
out (that is a meaningless statement). What you cannot figure out is;
what it is that you need to be able to figure out. And that is because
you have not yet grasped the basics of the subject, though you appear to
also be incapable of perceiving that.

To script a web browser for the internet you first need to know (at
minimum):-

1. The basic syntax and use of javascript (and eventually the details,
if you every hope to take full advantage of the language).

2. The browser object model; its structure and behaviour. (For which it
is necessary to understand how the DOM relates to (x)HTML source code.
Which, in turn requires a technical understanding of HTML.)

3. The differences between, and variability in, browser object models,
and the techniques for handling those differences.

4. The issues pertinent to web browser scripting; reliability, clean
degradation, accessibility, etc, etc.

From that basis you can move on to the bigger problems of script design
for the Internet, and so be in a position to produce something worth
talking about.

From your current position of having no comprehension of any of the
above, and apparently no interest in (or talent for) learning about
them, you can only waste your time. Which is fine, so long as you don't
bother anyone else with your nonsense.

Richard.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top