September 20th, 2005, 11:55 AM
|
#1 (permalink)
| | Ultimate Member
Join Date: Nov 2004 Location: Ottawa, Ontario
Posts: 2,661
| Mouseover HTML not working correctly
Well i have to make this web-based story dealie in one of my classes, and so we need to add all the bad looking corny stuff to make the grade.
Most people are using Fireworks...but it leaves like 5 lines of javascript and like 10 lines of HTML for each mouseover image...I like to keep my code good looking.
So I found a great piece of code that works great..and doesnt even use Javascript. The only problem is that I can't seem to use this code twice on the same page...and I need to do a home button, Start Story button, etc.
Here is the code: Code: <a href="index.html"
onmouseover="document.NAME.src='home1.gif'"
onmouseout ="document.NAME.src='home2.gif'">
<img name=NAME src='orig-picture'>
</a> Thanks in advance
__________________
-Space
|
| |
September 20th, 2005, 12:50 PM
|
#2 (permalink)
| | dword to your moms
Join Date: Oct 2001 Location: ~/
Posts: 3,195
|
You are changing the NAME variable with each entry, no? |
| |
September 20th, 2005, 01:10 PM
|
#3 (permalink)
| | Banned
Join Date: Jan 2004 Location: Earth
Posts: 420
|
Your problem lies with this line: Code: <img name=NAME src='orig-picture'> The src points to nothing.
You need something like this: Code: <a href="index.html" onmouseover="document.NAME.src='home1.gif';" onmouseout="document.NAME.src='home2.gif';">
<img name="NAME" src='home2.gif' alt="image" id="NAME" border="0" />
</a> by the way, the code within the mouseover and mouseout event is Javascript. :-) |
| |
September 20th, 2005, 01:12 PM
|
#4 (permalink)
| | Senior Member
Join Date: Nov 2001 Location: Central KS
Posts: 830
|
As what krohnjw said - remember that each time you use that document call, you have to change the name of the doc is it calling: Code: Instance #1:
<a href="" onmouseover="document.myimage.src='pic1.jpg'"
onmouseout="document.myimage.src='pic2.jpg'">
<img name="myimage" src="pic2.jpg"></a>
Instance #2:
<a href="" onmouseover="document.yourimage.src='pic3.jpg'"
onmouseout="document.yourimage.src='pic4.jpg'">
<img name="yourimage" src="pic4.jpg"></a> |
| |
September 20th, 2005, 04:33 PM
|
#5 (permalink)
| | Ultimate Member
Join Date: Nov 2004 Location: Ottawa, Ontario
Posts: 2,661
|
kay..thanks...i feel dumb...
What I meant by haveing "no javascript" is that I don't need to put seperate Javascript code in my head tag...this way I get a less bloated code. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |