473,651 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing text under picture

I have a site, http://www.onemorewebsite.com, that has a menu on the left
side and a picture on the right side with a middle div for content in the
middle. When I mouse over the menu, the picture changes. I've got that part
to work. But I also want the text caption under the picture to change also.
I can't figure this one out. I've spent days learning about innerHTML,
textnodes, etc..but nothing works. Can anyone give me a clue? I'd sure
appreciate it. I got append.textnode to work. I can append the caption all
day long, but I'm trying to replace it.
Thanks!
ca******@gmail. com
Feb 7 '06 #1
2 1837
Casey Miller wrote on 07 feb 2006 in comp.lang.javas cript:
I have a site, http://www.onemorewebsite.com, that has a menu on the
left side and a picture on the right side with a middle div for
content in the middle. When I mouse over the menu, the picture
changes. I've got that part to work. But I also want the text caption
under the picture to change also. I can't figure this one out. I've
spent days learning about innerHTML, textnodes, etc..but nothing
works. Can anyone give me a clue? I'd sure appreciate it. I got
append.textnode to work. I can append the caption all day long, but
I'm trying to replace it.


There are many ways, this is one:

<div id='nonHovering ' style='display: ;float:right;'>
<img src='img1.jpg'>
<br>
Text 1
</div>
<div id='Hovering' style='display: none;float:righ t;'>
<img src='img2.jpg'>
<br>
Text 2
</div>

.... menu ...
onmouseover="
var nonHovering = document.getEle mentById('nonHo vering');
var Hovering = document.getEle mentById('Hover ing');
nonHovering.sty le.display = 'none';
Hovering.style. display = '';"

onmouseout="
var nonHovering = document.getEle mentById('nonHo vering');
var Hovering = document.getEle mentById('Hover ing');
nonHovering.sty le.display = '';
Hovering.style. display = 'none';"

[a script function would make this more consize]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 7 '06 #2
VK

Casey Miller wrote:
I have a site, http://www.onemorewebsite.com, that has a menu on the left
side and a picture on the right side with a middle div for content in the
middle. When I mouse over the menu, the picture changes. I've got that part
to work. But I also want the text caption under the picture to change also.
I can't figure this one out. I've spent days learning about innerHTML,
textnodes, etc..but nothing works. Can anyone give me a clue? I'd sure
appreciate it. I got append.textnode to work. I can append the caption all
day long, but I'm trying to replace it.


Do not use document.write( ) on a loaded page: it clears its content and
breaks the script.

<html>
<head>
<title>DynTex t</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var myCaption = null;

function setCaption(txt) {
if (myCaption != null) {
myCaption.inner HTML = txt;
}
}

function init() {
if (document.getEl ementById) {
myCaption = document.getEle mentById('photo Caption');
}
else {
/*NOP*/
}
}

window.onload = init;
</script>
</head>

<body>

<p>
<a href="foobar.ht ml"
onmouseover="se tCaption('New caption 1')">Link 1</a>
<a href="foobar.ht ml"
onmouseover="se tCaption('New caption 2')">Link 2</a>
</p>

<p id="photoCaptio n">Photo caption</p>

</body>
</html>

Feb 7 '06 #3

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

Similar topics

1
4751
by: Calan | last post by:
I have a form with some picture boxes as buttons. I'm setting the picture property to a gif file for "normal", and to a different gif for the "pressed" state. This works fine. I get into trouble with the fact that the gif files have a transperent region in the middle (the button icon) that lets the back color of the picture box show through. This lets me change the button highlight to any user-specified color when I mouseover the picbox...
3
2152
by: JJM | last post by:
Can anyone please help me with this I'm a total newbie and just getting started in JS. I have a page where I would like to display a picture and a short textual explanation of the picture. I have several pictures that I would like to display all linking from a previous page. At present what I'm doing is linking each thumbnail to an individual html page showing the larger image with the text. It struck me that as the rest of the page is...
4
2475
by: Dj Frenzy | last post by:
Hi, I know how to use javascript to change a background image to another background image, and how to change a background colour to another background colour. Is there a way to change an image to a backgound colour? I have a table with a background that has a picture. When the user hovers over the picture I want the background to change to the background colour of the rest of the page, as if to make the picture disappear.
23
2682
by: Wade | last post by:
08122005 1505 GMT-5 Hello. I am working on a webpage for the local school (just before school starts). Their outside hired company really screwed things up. Im trying to get their computers up and running and gain access to their apps for them. There is this code that flips through images for World History class. I have removed the code from the page but the page still does not function.
6
9467
by: John Ortt | last post by:
Hi there everyone, I have a part info form which has a faded image of our company logo as a background. I want to replace the faded image with a bright red warning image on items which have run out of purchasing cover. I am nearly there, the only problem is that the code below only changes the image background for text and combo-box backgrounds, it doesn't apply it to the whole form.
2
3109
by: austinra | last post by:
i have a splash screen that i want to change a picture once a second for three seconds; then load my main form. what i want it to do is load a picture into a picture box; start a timer which will stop the loop for one second then start the loop again add 1 to the pintcount which will result in the name of aneither picture (my pictures are named 1, 2, 3) i have it in the form load event procedure. this is the code that i have so far. what i have...
10
1793
by: Anthony | last post by:
I am using the following code to display fading pictures on a team website. Can someone show me how to modify it such that I can display the names of each employee when the picture changes? This is not the complete code for the page but only the code relevant to what I am asking here. Some background information for you: the page is set up using a layout table and the pictures are displayed in a layout cell.I appreciate any help. ...
1
1600
by: larystoy | last post by:
Newbie to VB6, comfortable with HTML, MS Access so I ain't totally stupid. Maybe just dumb. Am writing a Biblical Quiz program where I need to change a picture and midi sound file each time a user advances to a new question. Have played with several routines but none seem to do what I want. The following will show the first picture, on click shows the second picture, on the next click shows the third picture. Each click thereafter...
8
2221
by: Jonathan Sachs | last post by:
I'm trying to compose a list of items, each of which consists of text that wraps around a picture at the left margin. The examples I have seen tell me to do it like this: <p><img src="xxxx.jpg" align="left" width=nn height=nn>zzz zzzzz zz zzzzz...</p> In my case, since the wrapped text includes a headline, I assume I am supposed to do this:
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8697
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8579
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7297
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1909
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1587
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.