krautinator
10-09-2003, 01:28 PM
Can you change a style w/ an event handler?
|
Click to See Complete Forum and Search --> : changing your style krautinator 10-09-2003, 01:28 PM Can you change a style w/ an event handler? spufi 10-09-2003, 01:52 PM Do you mean changing a stlye with something like JavaScript? Yes, that's basically what DHTML is in a nutshell. krautinator 10-09-2003, 01:56 PM so whatz wrong w/this?: <img src="blah.gif" onmouseover=style="filter:alpha (opacity=30)" onmouseout=style="filter:alpha (opacity=100)"> only need to implement it once, so there's really no use in writing a function for it. Vladdy 10-09-2003, 02:01 PM Originally posted by krautinator so whatz wrong w/this?: <img src="blah.gif" onmouseover=style="filter:alpha (opacity=30)" onmouseout=style="filter:alpha (opacity=100)"> hmm... pretty much everything... :cool: krautinator 10-09-2003, 02:08 PM Yeah I figured that much. what do I need to do to rectify the situation? TomDenver 10-09-2003, 04:53 PM Try this: <img src="image.jpg" id="img" onmouseover="document.getElementById('img').style.filter='alpha(opacity=30)';" onmouseout="document.getElementById('img').style.filter='alpha(opacity=100)';"> As far as I know, the filter stuff only works in IE though (4 and higher?). *Edit* Oops since you're not making this an external function or anything, you can just do this: <img src="image.jpg" onmouseover="this.style.filter='alpha(opacity=30)';" onmouseout="this.style.filter='alpha(opacity=100)';"> krautinator 10-09-2003, 04:59 PM thank you VERY much yea I guess Netscape users 'll just have to suffer haven't really been designing this page 'o' mine to be cross-browser anyway (too much friggin' trouble if your not a commercial site) webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |