How to make js code to 'minik' HTML a href ?

D

DL

so that on upon mouseover the "link" shows a hand like the behavior
over an HREF link?

The following is the current code set.

<span style="line-height: 15px; " onclick="if
(document.getElementById('org').style.display=='none')
{document.getElementById('org').style.display='inline'}
else{document.getElementById('org').style.display='none'}">
<font color="#00a700"><b>Smart Note Taking</b> (click here)</font></
span>

<div id="org" style="display:none"><p><br/>
+ This note-taking tool provides three fields for taking a note,
namely, <b>subject</b>, <b>tag (key concept)</b> and <b>notes</b>.
Hence, it provides a simple platform for linking notes to subject
matter, and the tag highlights critical matter at hand.</p>
<p><br/><br/>End result: it lays down a good foundation for subsequent
review.
</p>
</div>

Many thanks.
 
D

DL

so that on upon mouseover the "link" shows a hand like the behavior
over an HREF link?

The following is the current code set.

<span style="line-height: 15px; " onclick="if
(document.getElementById('org').style.display=='none')
{document.getElementById('org').style.display='inline'}
else{document.getElementById('org').style.display='none'}">
<font color="#00a700"><b>Smart Note Taking</b> (click here)</font></
span>

<div id="org" style="display:none"><p><br/>
+ This note-taking tool provides three fields for taking a note,
namely, <b>subject</b>, <b>tag (key concept)</b>  and <b>notes</b>.
Hence, it provides a simple platform for linking notes to subject
matter, and the tag highlights critical matter at hand.</p>
<p><br/><br/>End result: it lays down a good foundation for subsequent
review.
</p>
</div>

Many thanks.

Solved. Silly question, easily solved.
 
D

DL

[snip code]
Solved.  Silly question, easily solved.

Just for the record, it's usually a good idea to post the solution, in
case other people stumble upon your question. I'm guessing it was
something along the lines of "cursor: pointer", or its JS equivalent. I
had meant to reply to your post, but forgot. Sorry. There's been a lot
of noise in this group in the past few days.

Ok, Stefan,

I just moved the js event from the <SPAN> tag to an HREF like the
following:

<a href="#smartNote" onclick="if
(document.getElementById('org').style.display=='none')
{document.getElementById('org').style.display='inline'}
else{document.getElementById('org').style.display='none'}">
<b>Smart Note Taking</b></a>

Cheers,

Don
 
T

Thomas 'PointedEars' Lahn

DL said:
[...]
I just moved the js event

It is _not_ a "js event". Event-_handler_ attributes and the DOM API are
_language-independent_.
from the <SPAN> tag to an HREF like the following:

<a href="#smartNote" onclick="if
(document.getElementById('org').style.display=='none')
{document.getElementById('org').style.display='inline'}
else{document.getElementById('org').style.display='none'}">
<b>Smart Note Taking</b></a>

Looks like a bad idea.

1. Get rid of the redundant document.getElementById('org') calls by using
variables.

2. Is there a "smartNote" anchor in your document?

a) If yes, do you want to navigate to it after you showed/hid the
element with ID "org"?

i. If no, add `; return false' to the event-handler attribute
value to prevent the default action.

b) If no, use a dynamically written element instead, prevent the
default action if necessary, and use `cursor: pointer' if
necessary (but think twice about changing the default cursor;
the affordance of the element should still be clear afterwards).


PointedEars
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top