473,406 Members | 2,619 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,406 software developers and data experts.

Mouseover events...

Hi NG!

I want to make my site more dynamic... but i dont find out how this works...

On my site there is at the left side the navigation bar and at the rigt side
i want to put a photo. The photo should change when someone puts the cursor
over the links in the left side.

Does anybody kno how this works?

thx
Uwe
Jul 23 '05 #1
5 1245
Make sure the <img> tag for the photo has an id="" attribute. In the
onmouseover="" attribute of the link you can do something like:

document.getElementById('photoId').src='newphoto.j pg'

This may not exactly work, but at least it points you in the right
direction.

Jul 23 '05 #2

"Tony" <to********@gmail.com> schrieb im Newsbeitrag
news:11**********************@f14g2000cwb.googlegr oups.com...
Make sure the <img> tag for the photo has an id="" attribute. In the
onmouseover="" attribute of the link you can do something like:

document.getElementById('photoId').src='newphoto.j pg'

This may not exactly work, but at least it points you in the right
direction.


Boahh, that sounds very good! But i dont know it exactly, because I did not
have much expiriences with javascript how it works...

Is it possible to give with javescript a variable to html? So i could do a
variable with an image and in the html tag i could say something like this:
<img src="var1"...
is this possible?

thx Uwe
Jul 23 '05 #3
On Sun, 28 Nov 2004 11:05:36 +0100, Uwe Allgäuer
<uw***********@students.fh-vorarlberg.ac.at> wrote:
"Tony" <to********@gmail.com> schrieb im Newsbeitrag
news:11**********************@f14g2000cwb.googlegr oups.com...
[snip]
document.getElementById('photoId').src='newphoto.j pg'


The images collection is preferred:

document.images['photoId'].src = '...';
Is it possible to give with javescript a variable to html?


A way was proposed once, but it was never adopted, so no.

[snip]

What you're look for is something like

function setPhoto(url) {
document.images['photoId'].src = url;
}

where 'photoId' is the id attribute value of your main IMG element.

On the links, you'd have

<a ... onmouseover="setPhoto('relative or absolute URL');">

which would change the source of the IMG element to the value of the
string.

Note that this is a very simple approach to the problem.

Hope that helps,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
----- Original Message -----
From: "Uwe Allgäuer" <uw***********@students.fh-vorarlberg.ac.at>
<snip>
Is it possible to give with javescript a variable to html? So i could do a
variable with an image and in the html tag i could say something like this: <img src="var1"...
is this possible?


No.

In any case you'd still need to update the image path contained in var1
onmouseover, so you wouldn't save any typing (beyond, perhaps, one line).

Joakim Braun
Jul 23 '05 #5

"Joakim Braun" <jo**********@jfbraun.removethis.com> schrieb im Newsbeitrag
news:zu******************@nntpserver.swip.net...
----- Original Message -----
From: "Uwe Allgäuer" <uw***********@students.fh-vorarlberg.ac.at>
<snip>
Is it possible to give with javescript a variable to html? So i could do a variable with an image and in the html tag i could say something like

this:
<img src="var1"...
is this possible?


No.

In any case you'd still need to update the image path contained in var1
onmouseover, so you wouldn't save any typing (beyond, perhaps, one line).

Joakim Braun


Well thanks a lot to all!

I try hard to do this, if there are other questions i will ask again... :-)

Thx
Uwe
Jul 23 '05 #6

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

Similar topics

3
by: Colin Steadman | last post by:
Help! I'm a stupid HTML bod and I dont do Javascript! I have a grey coloured table that displays certain columns in either red, green or orange to give meaning and emphasis to certain data. ...
2
by: bidalah | last post by:
Hi everyone, I have a form that I created using tables. I want to create mouseover events which act on labels that are inside certain table cells so that when the mouse is over these label,...
2
by: Mitch | last post by:
I am hosting a web browser ctl in a container that implements the IDocHostUIHandler interface. I'm using this to control the context menu.This works fine. Then, I added a mouseover event to the...
7
by: rkbnair | last post by:
Is it possible to change the background color of the DataGrid on pointing the mouse over a certain row?
5
by: JB | last post by:
I am struggling to figure out a way to allow one element to be dragged, but still capture 'mouseover' events on other elements. I've created a simple example to demonstrate what I mean:...
1
by: dheepakk | last post by:
Hi All, When a mouseover event takes place over a link the popup window is displayed. I also have a mouseout on the link.So if the popup window comes up,has a dimension such that the...
1
sgeklor
by: sgeklor | last post by:
Dear All, My question refers to how best to organise my mouse events to correctly and efficiently give the effect I want. On my form I have a panel and that panel contains a number of controls....
1
by: Nyarlathotep333 | last post by:
OK, I am new to Javascript but good with CSS and HTML coding. I have a little experience with Java and .NET as well. Here's what I'm trying to do. I have three images of an animated spider. The...
2
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the...
7
by: Microsoft Newsserver | last post by:
Hi, Simple question, probably a simple answer hopefully. I am working with VS2005/2.0 and this is an Explorer project IE6/IE7. The issue is I need to be able to mouseover the options in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.