Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>Help with a simple script...

Help with a simple script...

SerenadeSP
10-12-2005, 11:55 PM
I need help on a rollover script...

Here's the mark-up. Can someone tell me what I did wrong?


<!-- Hidden Script

var d = newData ()
var name = d.mouseOver; mouseOut

function mouseOver()
{
document.r1.src ="epee1.png"
}
function mouseOut()
{
document.r1.src =rapier1.png"

// End of Hidden Script -->


(I know this is pretty simple, but I just started scripting in Java like 2 days ago...)

_Aerospace_Eng_
10-13-2005, 12:15 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function mouseOver()
{
document.r1.src ="epee1.png"
}
function mouseOut()
{
document.r1.src =http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"rapier1.png"
}
//-->
</script>
</head>

<body>
<a href=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"#" onmouseover="mouseOver()" onmouseout="mouseOut()"><img src=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"rapier1.png" alt="" name="r1"></a>
</body>
</html>
I personally wouldn't use Javascript for a simple image rollover. I would use CSS. You might want to pass variables to your function so you don't end up having like 5 different functions that do the same thing with different names.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function changeImages(where,what){
document.getElementById(where).src=http://www.codingforums.com/archive/index.php/what;
}
//-->
</script>
</head>

<body>
<a href=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"#" onmouseover="changeImages('r1','epee1.png')" onmouseout="changeImages('r1','rapier1.png')"><img src=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"rapier1.png" alt="" name="r1" id="r1"></a>
</body>
</html>


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

window.open - cannot open with scrollbars
.js file
Help with a color fader, not going fast enough!
error someone help please
color name selector
?'s About JavaScript cart
Grabbing a DOM for use with Google Maps
How can I create a stacked list of thumbnails, each one expanding with more info?

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics