HTML Query

R

Ramon

Hi,

Does someone here knows if there exists a tag that can fold/hide text...
and when the user clicks it, the text will become visible.

Thanks
 
N

Neredbojias

Hi,

Does someone here knows if there exists a tag that can fold/hide
text... and when the user clicks it, the text will become visible.

Thanks

How would the user be able to click it when it's invisible?
 
R

Ramon

Neredbojias said:
How would the user be able to click it when it's invisible?
What I meant is that you have something like this:
[+] Click here to see more information.

When the user clicks on the [+], he/she will see something like this:
[+] Click here to see more information.
Some text here that the user could not see
before -- thus invisible :)
Other text here ...

Is is possible in HTML?
 
J

Jukka K. Korpela

The answer to that question is obviously "by accident", though some people
may include the possibility of "by miracle".
What I meant is that you have something like this:
[+] Click here to see more information.

When the user clicks on the [+], he/she will see something like this:
[+] Click here to see more information.
Some text here that the user could not see
before -- thus invisible :)
Other text here ...

It's generally useful to ask what you really want, instead of something
quite different. It is also a good idea to write a Subject line that gives
at least a subtle hint of a clue of an allusion to what the content is
about.

It's generally useful to present your content to users without hiding it in
elaborate ways that generally exhibit poor accessibility, poor usability,
and poor style. "Click here" is virtually always bad style.
Is is possible in HTML?

No. You need to study an introduction to the basics of HTML if you had the
idea that it could be. HTML is poor lonesome data format, not a programming
language or even a style language.

Well of course it _is_ possible in the sense that "[+]" could be a link
pointing to a page that differs from the current one only so that there is
the additional content there (and the content after it is pushed downwards
of course). But that's hardly what you meant.

What people normally use to do things like you describe is a combination of
JavaScript and CSS; naturally there needs to be some marked-up data (i.e.,
HTML stuff) for them to play with. And sometimes people use just CSS
(playing on HTML of course), though then the user just mouses over instead
of clicking. It can be fun, to an author, but it's normally not useful.
 
R

Ramon

Jukka said:
The answer to that question is obviously "by accident", though some
people may include the possibility of "by miracle".
What I meant is that you have something like this:
[+] Click here to see more information.

When the user clicks on the [+], he/she will see something like this:
[+] Click here to see more information.
Some text here that the user could not see
before -- thus invisible :)
Other text here ...

It's generally useful to ask what you really want, instead of something
quite different. It is also a good idea to write a Subject line that
gives at least a subtle hint of a clue of an allusion to what the
content is about.

It's generally useful to present your content to users without hiding it
in elaborate ways that generally exhibit poor accessibility, poor
usability, and poor style. "Click here" is virtually always bad style.
Is is possible in HTML?

No. You need to study an introduction to the basics of HTML if you had
the idea that it could be. HTML is poor lonesome data format, not a
programming language or even a style language.

Well of course it _is_ possible in the sense that "[+]" could be a link
pointing to a page that differs from the current one only so that there
is the additional content there (and the content after it is pushed
downwards of course). But that's hardly what you meant.

What people normally use to do things like you describe is a combination
of JavaScript and CSS; naturally there needs to be some marked-up data
(i.e., HTML stuff) for them to play with. And sometimes people use just
CSS (playing on HTML of course), though then the user just mouses over
instead of clicking. It can be fun, to an author, but it's normally not
useful.

Thanks.
 
J

Jonathan N. Little

Bergamot said:
if(document.layers)...

icky-poo!
Not sue how many Netscape 4.x users are still out their, but at least
they are using *object* detection of stupid user agent sniffing...I am
getting awful tired if PayPal's warning dialogs in their tools that my
browser is not supported "IE 5.5+ FF 1.0+ Safari 1.2+" while using
SeaMonkey 1.1.14
 
J

Jonathan N. Little

Jonathan said:
Not sue how many Netscape 4.x users are still out their, but at least
*sure*

they are using *object* detection of stupid user agent sniffing...

The site's real error is that they have the text hidden by default in
the styling. It should be displayed and the via JavaScript upon loading
set to hide so that if the user has JavaScript disabled the content is
visible.

The Rule is JavaScript is option and the page should be usable without it.
 
T

Tim Greer

Ramon said:
Hi,

Does someone here knows if there exists a tag that can fold/hide
text... and when the user clicks it, the text will become visible.

Thanks

CSS is good for this sort of thing, as is JavaScript, or something like
Flash, depending on the technology you want to use. CSS might be the
most compatible with the most browsers.
 
D

dorayme

Bergamot said:
icky-poo!

This expression is a little too babyish for grown ups around here."Yuk"
might just get over the line for adults. "Bloody hell!" (and stronger as
far as I am concerned) and "Geez" are also perfectly acceptable to most
people. Some others, perhaps more Australian in nature, would be ok too:
"Don't make me puke, mate" and "Piss poor, mate".
 
J

Jani

Hi,

Does someone here knows if there exists a tag that can fold/hide text...
and when the user clicks it, the text will become visible.

Thanks

What about event listeners?
Also javascript but you can sit long time to get a nice hotspot or
image-map matrix:
a mouse over here - some text there. But only for a more grafical
realization. Like the buttons of a mobile phone.
 
J

Jonathan N. Little

Jani said:
What about event listeners?

Event listeners *is* JavaScript, not HTML. HTML cannot *do* anything, it
is not a programming language, it is markup only, HyperText Markup
Language...
 
C

Chaddy2222

HTH.  Just remember that you need to also account for the minority of
browsers who visit and have javascript turned off.
What, like Googlebot for example!
 
H

houghi

Chaddy2222 said:
What, like Googlebot for example!

No, firefox, Internet Explorer, Opera and others where people have
decided to turn off javascript.

houghi
 
J

Jani

Event listeners *is* JavaScript, not HTML. HTML cannot *do* anything, it
is not a programming language, it is markup only, HyperText Markup
Language...

But the browser can do it for you [1]
And you can add a little JavaScript. [2] The W3C also handle a little
bit with events.

[1]

<style type="text/css">
<!--
a:link {
color: #FFFFFF;
text-decoration:none;
}
a:visited {
color: #FFFFFF;
}
a:active {
color: #FF0000;
}
..green { color: #00CC00 }
-->
</style>
</head>

<body>
<a href=""><span style="color:black">[+] Hello! Me I am the first
line.</span>
<br />
<br />
<span class="green">Here</span> is some more text.<br />
Here <span class="green">is</span> some more text.<br />
Here is <span class="green">some</span> more text.<br />
Here is some <span class="green">more</span> text.<br />
Here is some more <span class="green">text.</span><br /> </a>
</body>




[2]

<body>


<script type="text/javascript">
<!--
document.writeln('<table cellspacing="0" cellpadding="0">');
for(i=0 ; i<20 ; i++)
{
document.writeln('<tr>');
for(j=0 ; j<20 ; j++)
{

k = i*20 + j + 2*i;
l = k + 1;
m = k + 2;
n = k - 1;
o = k - 2;

p = k - 22;
q = k - 44;
r = k + 22;
s = k + 44;

document.writeln('<td><img src="yellow.gif" id="' + k + '"
onMouseOver="document.getElementById(\'' + l + '\').src=\'blue.gif\',

document.getElementById(\'' + m + '\').src=\'blue.gif\',
document.getElementById(\'' + n + '\').src=\'blue.gif\',
document.getElementById(\'' + o +

'\').src=\'blue.gif\', document.getElementById(\'' + p + '\').src=
\'blue.gif\', document.getElementById(\'' + q + '\').src=\'blue.gif
\',

document.getElementById(\'' + r + '\').src=\'blue.gif\',
document.getElementById(\'' + s + '\').src=\'blue.gif\'"
onMouseOut="document.getElementById(\'' + l

+ '\').src=\'yellow.gif\', document.getElementById(\'' + m + '\').src=
\'yellow.gif\', document.getElementById(\'' + n + '\').src=\'yellow.gif
\',

document.getElementById(\'' + o + '\').src=\'yellow.gif\',
document.getElementById(\'' + p + '\').src=\'yellow.gif\',
document.getElementById(\'' + q +

'\').src=\'yellow.gif\', document.getElementById(\'' + r + '\').src=
\'yellow.gif\', document.getElementById(\'' + s + '\').src=\'yellow.gif
\'"></td>');

}
document.writeln('</tr>');
}
document.writeln('</table>');
//-->
</script>

</body>
 
J

Jonathan N. Little

Jani said:
Event listeners *is* JavaScript, not HTML. HTML cannot *do* anything, it
is not a programming language, it is markup only, HyperText Markup
Language...

But the browser can do it for you [1]
And you can add a little JavaScript. [2] The W3C also handle a little
bit with events.

Okay, I will try to explain this to you. JavaScript is not HTML. Already
mentioned in thread this cannot be done with HTML but would need
JavaScript. The problem is JavaScript is optional, so the usual caveats
apply. The functionality of the page *must* preserved if JavaScript is
not enabled. So the page should be in a fully readable state when
JavaScript is not present.
[1]

<style type="text/css">
<!--
^^^^^^
Stop putting HTML within STYLE elements. They are *not* required as so
many erroneously believe.
a:link {
color: #FFFFFF;
text-decoration:none;
}
a:visited {
color: #FFFFFF;
}
a:active {
color: #FF0000;
}
.green { color: #00CC00 }
-->
</style>
</head>

<body>
<a href=""><span style="color:black">[+] Hello! Me I am the first
^
Having an empty HREF is not a good idea, can have unwanted side effects.
Far better to attach an onclick handler directly to the element, in your
example it would be the SPAN, however I would think DIV of would be
more appropriate.
line.</span>
<br />
<br />
<span class="green">Here</span> is some more text.<br />
Here <span class="green">is</span> some more text.<br />
Here is <span class="green">some</span> more text.<br />
Here is some <span class="green">more</span> text.<br />
Here is some more <span class="green">text.</span><br /> </a>
^^^^
Hmm using XHTML? In most cases, this is a very bad idea which has been
discussed ad nauseam. If you using strict then your "document.writeln"
statements are a *no-no!* JavaScript is optional, functionality of the
page *must* preserved if JavaScript is not enabled.

</body>




[2]

<body>


<script type="text/javascript">
<!--
document.writeln('<table cellspacing="0" cellpadding="0">');

"document.writeln" are usually a bad idea, and in your application,
absolutely a bad idea. Why? Because if the client has JavaScript
disabled he will see *nothing*. Remember above?

<snip code>

If I where to recommend a way to do this here is the parameters that I
would say are appropriate.

1. Create the full *static* page with all elements in the visible and
readable state. This includes this initial state defined in the CSS,
remember CSS is optional too!

2. Put all your JavaScript in an *external* file.

3. Related to #2, do not pepper your markup with handler attributes,
i.e., all those "onclick=" but instead attach the handlers with your
functions in your JavaScript. Of course MS's contrariness means code forks!

function someClickHandler(){
...
}

function initClickHandler(targetID){
var target=documentGetElementBtId(targetID);
if(target){
if(target.addEventListener){ //modern browsers
target.addEventListener('click', someClickHandler, false);
}
else if(target.attachEvent){ //Old MS IE support
target.attachEvent('onclick', someClickHandler);
}
else {
//ain't supported so do nothing
}
}
}

// function to call all your event handler inits
function attachMyEvents(){
initClickHandler();
// any other init functions add to list
...
}

//now set to page loads to set it all up
// attach event after page loads
if( window.addEventListener ) {
window.addEventListener('load',attachMyEvents,false); //legacy DOM
} else if( document.addEventListener ) {
document.addEventListener('load',attachMyEvents,false); //proper DOM
} else if( window.attachEvent ) {
window.attachEvent('onload', attachMyEvents); //Damn IE only
}
 
J

Jonathan N. Little

Jonathan said:
^^^^^^
Stop putting HTML within STYLE elements. They are *not* required as so

Correction: Stop putting HTML *comments* within STYLE elements.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top