FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need Rollover Image help





ainieas
Well I'm using this rollover image script:

Quote:
<script language="JavaScript" type="text/javascript">
<!-- Hide from older browsers
function SwitchImg()
{ //start
var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
(store.indexOf('document.all[')==0 && document.all==null))
store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
obj = eval(store);
if (obj != null) {
switcher[keep++] = obj;
switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
obj.src = SwitchImg.arguments[rem+2];
} }
document.Data = switcher;
} //end

function RestoreImg()
{ //start
if (document.Data != null)
for (var rem=0; rem<(document.Data.length-1); rem+=2)
document.Data[rem].src=document.Data[rem+1];
} //end

// end hiding contents -->
</script>

<a href=".html" onMouseOut="RestoreImg()" onMouseOver="SwitchImg('document.Ec','document.Ec','file:///D|/Documents and Settings/s/My Documents/Ec.jpg')"><img src="file:///D|/Documents and Settings/s/My Documents/elisha_cuthbert.jpg" name="Ec" width="100" height="118" alt="" border="0"></a>




Well the problem is that the image that I want to be rollevered to is larger than the first image (100*118) but the the second image (176*208) gets resized to the size of the first image. Is there anyway that the first image would retain its size (100*118) while the second image (176*208) would retain its?

P.S. Right now I'm just running the script locally - just for practice.
badai
try to remove width="100" height="118" and put valign and align to center
ainieas
Thanks a lot! I'll reply if it worked.
Azmo
shouldnt work with js, anyways.. use css instead? and set size of ur hoover image.

I think most javascript of this type kinda demans that both images are of the same size or it wil cause problems.. however this should be done with css since js is something alot of people dont like or have activated...

JS should be seen as a compliment to html/css.. if it can be done with css.. then it should.. if you cant do it with css then you should start thinking of you should use javascript/asp/ajax instead.. as a compliment, not a replacement.

GL with ur stuff btw!
Related topics
[Beginner] css rollovers
Advanced Rollovers
Tutorial: Image Rollovers w/ Javascript
THIS IS DRIVING ME MAD [resolved]
How do I make pic change with onmouseover?
CSS Help...
Dreamweaver (Duvida)
Drupal image help
swap image help
Javascript button effects
Best method of rollover images?
Drop down Menu
Rollover Buttons or Images
Auto Dimming the background image--Help please
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Design Tips

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.