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

How to apply a work explain for all document?

In my site,
There will be some word shold have explaination.
The explaination will be shown in a layer(<div>).

How can I add only a JS file to set all the word in every document?
Is it using regular expression and replace the body.innerHTML with the
word to onclick event?
Any better way?

Thank you.

Aug 14 '06 #1
2 1207
Hi Cylix,
In my site,
There will be some word shold have explaination.
The explaination will be shown in a layer(<div>).

How can I add only a JS file to set all the word in every document?
Is it using regular expression and replace the body.innerHTML with the
word to onclick event?
I did not completely understand what you asked, but try this...

<html><head>
<title>Explanations</title>
<style type="text/css">
#explainations dd {
display:none;
}
</style>
<script type="text/javascript">
function init() {
var explainations = document.getElementById('explainations');
var terms = explainations.getElementsByTagName("dt");
for(var i=terms.length-1;i>=0;i--) {
var ele = terms[i];

ele.onclick=function(e) {
if(!e) var e = window.event;
var explaination = this.nextSibling;
if(explaination.style.display != "block")
explaination.style.display="block";
else explaination.style.display = "none";
}
}
}
window.onload=init;
</script>
</head>
<body>
<dl id="explainations">
<dt>Hello</dt><dd>A form of greeting</dd>
<dt>42</dt><dd>The answer to life, the universe and everything</dd>
</dl>
</body></html>

Aug 14 '06 #2
Thanks for reply,

I mead that I have a number of HTM pages, maybe news acticle,
All of them contains the word "APPA".
I want to have a js. which atttached to all HTM,
so that the js will found out all the term "APPA" and set onMouseOver
event to the term "APPA"

Aug 17 '06 #3

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

Similar topics

4
by: Cyrille \cns\ Szymanski | last post by:
Hello, I have a XML document which is typically : <course> <section> <title>Foo</title> There comes the text </section> <section>
0
by: Sparko | last post by:
My Xml is as follows; <root> <st id="1"> <rt id="1"> <cr id="1" ca_w="" ca_x="" ca_y="" ca_z="" other attribs> <ct some attribs> <te some attribs /> <te some attribs />
4
by: Iver Erling Årva | last post by:
I have an application that uses a window.open() to open it's own main window where all my programs takes place. I use a timeout so if nothing goes on for 15 minutes the document below is called. To...
3
by: niconedz | last post by:
Hi The following code works fine in IE but not Firefox. It's a little script that zooms an image and resizes the window to fit. Can anybody tell me what's wrong? Thanks Nico == btw.....
1
by: j_mckitrick | last post by:
Hi all, I'm making Ajax-type calls that return XML, and rather than parsing the XML with DOM and building the nodes by hand, it seems much better and well-designed to get the XML response, get...
1
by: bs9999 | last post by:
Can someone please tell me why when i use <object>.clondeNode that when I appendChild it to my document, the new node doesnt properly work? I'm making a clone of a <scriptand <linknode from an...
4
by: planb | last post by:
Hi, I'd like to have a rollover like effect when a input field has the focus, any idea of how to do this with just CSS (easy enough with javascript)? What I'm thinking of is having a tips box...
3
by: abhishek.smu | last post by:
Given an XML like: <root> <node>8</node> <node>21</node> <node>-7</node> <node>13</node> <node>43</node> <node>2</node> </root>
4
by: Beagle804 | last post by:
OK. I'm very new to Javascript and what I've learned so far has been find snippets of code on the web and using them in my php programs. I put together an application that allows a Reset button to...
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
0
BarryA
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.