Hi, I while back I was having a problem with rollovers, even though I do
them in a very conventional way:
function roll(i) {
document[i].src = eval(i + "_roll.src" )
} // in which value passed to function is "name" attr in img tag..
but on my home page, www.francesdelrio.com, I have rollovers like this:
function doRoll(Img,newI mage) {
Img.src = newImage.src;
Img.width = newImage.width; // what's the point
Img.height = newImage.height ; // of these two?
}
function roll_web() {
doRoll(document .web, web_roll);
} // etc.
I'm just trying to remember why I did it like this, it was a solution
given to me by someone in this ng, I believe the problem might have been
that rollovers were not working in Opera (don't have Opera installed
anymore, can't check it out); does this mean all my other rollovers are
not working in Opera? (if you have Opera, can u pls go to www.francesdelrio.com/resume in Opera and roll over images near top of
page and see if rollovers work? How prevelant is use of Opera? do I
need to always script taking Opera into account? And does Opera behave
the same w/mac as w/PCs?) thank you..
Frances Del Rio 2 1504
Frances Del Rio <fd***@yahoo.co m> writes: Hi, I while back I was having a problem with rollovers, even though I do them in a very conventional way:
function roll(i) { document[i].src = eval(i + "_roll.src" ) } // in which value passed to function is "name" attr in img tag..
That might be conventional, but it sure isn't good. You should never
use eval to access elements. It easily leads to problems, and there are
always better ways.
Also, it seems you write document[i] to refer to the image whose name
is in i. It is much safer and standards compliant to use
document.images[i].
I assume i+"_roll" refers to a global variable referring to an Image
element (used for preloading the image file). Apart from polluting the
global namescape, global variables are harder to refer to
programatically , so I would have preferred to keep them in an
object. That is, instead of:
var foo_roll = new Image();
foo_roll.src = "someImg.pn g";
var bar_roll = new Image();
bar_roll.src = "someOtherImg.p ng";
...
I would do:
var myImages = new Object();
myImages['foo'] = new Image();
myImages['foo'].src="someImage .png";
myImages['bar'] = new Image();
myImages['bar'].src="someOther Image.png";
...
Then the above could be written as
document.images[i].src = myImages[i].src;
but on my home page, www.francesdelrio.com, I have rollovers like this:
function doRoll(Img,newI mage) { Img.src = newImage.src; Img.width = newImage.width; // what's the point Img.height = newImage.height ; // of these two?
Sets the image height and width to the ones of the image you switch
to.
} function roll_web() { doRoll(document .web, web_roll); } // etc.
I'm just trying to remember why I did it like this, it was a solution given to me by someone in this ng, I believe the problem might have been that rollovers were not working in Opera (don't have Opera installed anymore, can't check it out); does this mean all my other rollovers are not working in Opera? (if you have Opera, can u pls go to www.francesdelrio.com/resume in Opera and roll over images near top of page and see if rollovers work?
Using Opera 7.5 preview 4. It doesn't work.
The page contains this gem:
var div_top = eval('document. getElementById( ' + "curr_div" + ')')
As always, eval is not needed. In this particular case it is
completely unnecessary. Just write:
var div_top = document.getEle mentById(curr_d iv);
Ditto for
var div_top = eval('document. all.' + curr_div)
which should just be:
var div_top = document.all[curr_div];
How prevelant is use of Opera?
Who knows. I use it all the time. Opera Software can apparently earn a
profit selling it, so there has to be some users. I see statistics between
0 and 2 procent most of the time, but as ususal, you can't trust these.
Out of the box, Opera identifies itself as IE to people who don't know
where to look.
do I need to always script taking Opera into account?
Shouldn't be necessary, *if* you code to the standards. Opera has very
good standards support, as do most modern browsers (which excludes IE
:). Writing to standards will allow you to support Mozilla, Opera,
Safari, Konqueror, IceBrowser, etc., including browsers you have never
heard about and browsers that have not been written yet.
And does Opera behave the same w/mac as w/PCs?)
Opera 7 uses the same code base for all platforms, so it should act
the same (although installed fonts might differ between platforms).
Opera 6 had more differences, but nothing that would affect a
roll-over script. They have worked almost the same since the first
browser to support them.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen wrote: Also, it seems you write document[i] to refer to the image whose name is in i. It is much safer and standards compliant to use document.images[i].
ooooppsss.. right about that.... thanks..
pt well taken re eval(yada yada)
I took that script verbatim from a DHTML book -- (by Jason Teague, from
QuickStart series.. concise little books, at times very useful ;)....)
but I also went thru JS Bible practically cover-to-cover.. and if I
remember well, I believe I author (Danny sthg) says there that when you
have a long string to be tapped it's better to do like this
( eval(yoyo) ) go figure.. so many people have so many diff. ways of
doing things... many thanks for yr useful response... Frances
I assume i+"_roll" refers to a global variable referring to an Image element (used for preloading the image file). Apart from polluting the global namescape, global variables are harder to refer to programatically , so I would have preferred to keep them in an object. That is, instead of: var foo_roll = new Image(); foo_roll.src = "someImg.pn g"; var bar_roll = new Image(); bar_roll.src = "someOtherImg.p ng"; ... I would do: var myImages = new Object(); myImages['foo'] = new Image(); myImages['foo'].src="someImage .png"; myImages['bar'] = new Image(); myImages['bar'].src="someOther Image.png"; ... Then the above could be written as document.images[i].src = myImages[i].src;
but on my home page, www.francesdelrio.com, I have rollovers like this:
function doRoll(Img,newI mage) { Img.src = newImage.src; Img.width = newImage.width; // what's the point Img.height = newImage.height ; // of these two?
Sets the image height and width to the ones of the image you switch to.
} function roll_web() { doRoll(document .web, web_roll); } // etc.
I'm just trying to remember why I did it like this, it was a solution given to me by someone in this ng, I believe the problem might have been that rollovers were not working in Opera (don't have Opera installed anymore, can't check it out); does this mean all my other rollovers are not working in Opera? (if you have Opera, can u pls go to www.francesdelrio.com/resume in Opera and roll over images near top of page and see if rollovers work?
Using Opera 7.5 preview 4. It doesn't work. The page contains this gem: var div_top = eval('document. getElementById( ' + "curr_div" + ')') As always, eval is not needed. In this particular case it is completely unnecessary. Just write: var div_top = document.getEle mentById(curr_d iv); Ditto for var div_top = eval('document. all.' + curr_div) which should just be: var div_top = document.all[curr_div]; How prevelant is use of Opera?
Who knows. I use it all the time. Opera Software can apparently earn a profit selling it, so there has to be some users. I see statistics between 0 and 2 procent most of the time, but as ususal, you can't trust these. Out of the box, Opera identifies itself as IE to people who don't know where to look.
do I need to always script taking Opera into account?
Shouldn't be necessary, *if* you code to the standards. Opera has very good standards support, as do most modern browsers (which excludes IE :). Writing to standards will allow you to support Mozilla, Opera, Safari, Konqueror, IceBrowser, etc., including browsers you have never heard about and browsers that have not been written yet.
And does Opera behave the same w/mac as w/PCs?)
Opera 7 uses the same code base for all platforms, so it should act the same (although installed fonts might differ between platforms). Opera 6 had more differences, but nothing that would affect a roll-over script. They have worked almost the same since the first browser to support them.
/L This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lorne Cameron |
last post by:
I've put together a rough copy of what will be my site's menu bar, but
I'm not sure if I've done the rollovers correctly (I got the code from
HTMLcodetutorial.com I think). Check the look and code out here -
http://www.sportsunion.strath.ac.uk/snowsports/new_menu_test/index.html
When I roll my mouse over an image, it changes as expected, but in
Mozilla, when I take the mouse away, there is a slight delay before the
image reverts to its...
|
by: Steve Lockridge |
last post by:
We have recently created simple javascript rollovers on a site using
Macromedia Fireworks. What is weird is that four of them work and one
doesn't on the Mac platform using Safari and IE. The NN and Camino
browsers work.
Before I give you the URL, I wanted to let you know I am not referring
to the swap image behavior. I am referring to the simple rollover
where the OnMouseOver state puts a green glow behind the text.
...
|
by: Kanuf |
last post by:
On a page I am designing, I'm trying to create a "div rollover".
Basically, I want a div's contents to change (or a new div to replace
the old one) via hover.
I have tried this, but it doesn't seem to work.
TEXT and IMAGE
|
by: gallery |
last post by:
I also cross-posted this in comp.infosystems.www.authoring.html. I think
it's more appropriate here.
I read somewhere that you can get Tim Murtaugh's Mo' Betta Rollovers to work
in Firefox using just CSS (no javascript) .
Can someone tell me how to do it?
http://www.alistapart.com/articles/rollovers/
|
by: idiotprogrammer |
last post by:
Hi, there,
I'm trying to do something, and part of the problem is that I don't
know how to describe the effect.
One block will have a list of links stacked over one another and
separated by p tags.
When the user hovers over any link inside this block, a description of
a link will appear slightly to the right of the link (let's say 1 inch
| |
by: Shahid Juma |
last post by:
Hi,
Is it possible to do roll overs over an area of an image. I know you can
setup up a hotspot but can a roll over be done on that particular hotsop.
Additionally, when the image changes on the roll over, can a certain area of
this new image be shown instead of the whole one?
Thanks,
Shahid
(remove NOSPAM from the email address when replying to my email address)
|
by: Norman Swartz |
last post by:
Rollovers on a web page I created were instantaneous on my computer when
the page was loaded directly from my hard drive, but were painfully slow
when loaded from the web. However, on another computer the rollovers were
speedy when connected to the web. Eventually I found that one of the
settings in IE accounted for the difference. In the menu Tools/Internet
Options/General/Settings change from "Every visit to the page" to...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why are my Rollovers so slow?
-----------------------------------------------------------------------
Images are cached by the browser depending on the headers sent by
the server. If the server does not send sufficient information
for the browser to decide the image is cacheable, the browser
will check if the image has been updated everytime you change...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why are my rollovers so slow?
-----------------------------------------------------------------------
Images are cached by the browser depending on the headers sent by
the server. If the server does not send sufficient information
for the browser to decide the image is cacheable, the browser
will check if the image has been updated everytime you change...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |