[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 04-12-2004, 06:06 AM   #1 (permalink)
New Member
 
Join Date: Apr 2004
Location: hell
Posts: 5
3.00 NP$ (Donate)

killmesuicide is an unknown quantity at this point


xhtml/javascript image rollover , help me

im trying to make a basic image rollover i have tried all the ways but they all screw up on me, i cant get it to work, strangley as i was able to months ago but i forgot how. now nothing i do works.
this is the code for the one that i thought was most likeley to work but guess what ..still dosnt work.
someone please tell me what im doing wrong, or explain to me how to re write the whole thing, before i jump off a cliff in fraustration.



<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">

<head>

<script language="Javascript">

<!-- Hide script from old browsers


if (document.images) {

enterm1 = new Image
enterm2 = new Image

enterm1.src="indexfi/enterm1.jpg"
enterm2.src="indexfi/enterm2.jpg"

}

else {

enterm1 = ""
enterm2 = ""
document.enter = ""

}


// End hidig script from old browsers -->

</head>

<body bgcolor="000000">


<div align="center">


<table border="0" width="370">


<tr>
<td>
<img src="indexfi/itc0r1.jpg" width="367" height="260" />
</td>
</tr>


<tr>
<td>

<img src="multipfi/sxbox.jpg" width="368" height="39" />
</td>
</tr>


<tr>
<td>
<a href="main.html" onmouseover=
"document.enter.src=enterm2.src"
onmouseout="document.enter.src=enterm1.src">

<img src="indexfi/enterm1.jpg" width="366" height="61" /> </a>

</td>
</tr>


</table>

</div>



</body>

</html>


i heard that a lot of people dont have javascript turned on, so whats the point in me making a javascript rollover? and if i do it in css, the people who dont have css enabled wont be able to see it.
so i guess im supposed to do both and do the if thing to check which user has what browser so i can direct them to the correct code.
but i cant even do any of them yet. have i been killing too many brain cells recently? i could just use dreamweaver but i really want to learn to code things. i will learn this s*** or die trying
thankyou very much for your help if you can be assed to help me.
killmesuicide is offline  
Old 04-13-2004, 07:35 AM   #2 (permalink)
NamePros Member
 
Roenick's Avatar
 
Join Date: Feb 2004
Location: Baltimore/Washington D.C.
Posts: 49
37.00 NP$ (Donate)

Roenick is an unknown quantity at this point


most current browsers support javascript and css so don't worry about that.

try this for your image swap...

put the following in your <head> tag:

<script language = "JavaScript">
<!--
if (document.images) {

img1on = new Image(); //Active Images
img1on.src = "indexfi/enterm2.jpg";

img1off = new Image(); //Inactive Images
img1off.src = "indexfi/enterm1.jpg";
}

function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");
}
}

function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");
}
}

//-->

</script>


then put the following inside your <body>:

<a href="main.html"
onMouseOver = "imgOn('img1')"
onMouseOut = "imgOff('img1')">
<img name ="img1" height=61 width=366 src="indexfi/enterm1.jpg" alt="" border=0></a>
__________________
" be the change you wish to see in the world " – gandhi
Roenick is offline  
Old 04-13-2004, 04:36 PM   #3 (permalink)
New Member
 
Join Date: Apr 2004
Location: hell
Posts: 5
3.00 NP$ (Donate)

killmesuicide is an unknown quantity at this point


ahhh thankyou alot. Works perfectly your a * . ill learn your code so i know how to do it propely. thanx a lot for your help! much appreciated!
killmesuicide is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 10:21 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85