473,765 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Swap images if Javascript is disabled

Hello out there,
I know that I can replace an image with another using e.g.
onMouseOver="sw apIn(...)"
and
onMouseOut="swa pOut(...)"

Is there anything I can do if Javascript is disabled?
- I guess I could use 'noscript' to provide a link which opens an
external window to display the second image'
- any other possibilty?

On a related note: Is it possible (without Javascript) to open a new
window giving its dimension and omitting the usual "decoration s" - it
is for displaying a small image which looks ridiculous if a "normal"
window would open.
Any info will be greatly appreciated.
Best regards
Helmut Giese
Jun 27 '06 #1
7 2673
hg****@ratiosof t.com (Helmut Giese) wrote:
Hello out there,
I know that I can replace an image with another using e.g.
onMouseOver="sw apIn(...)"
and
onMouseOut="swa pOut(...)"

Is there anything I can do if Javascript is disabled?
If it's a background images then you can change it via :hover in CSS.
- I guess I could use 'noscript' to provide a link which opens an
external window to display the second image'
- any other possibilty?
Just link to it normnally as the standard, then add JavaScript on top
of that. Starting with the JS gizmos and then adding the basics is
almost always the wrong way round.
On a related note: Is it possible (without Javascript) to open a new
window giving its dimension and omitting the usual "decoration s"
No.
it is for displaying a small image which looks ridiculous if a "normal"
window would open.


Then don't open it in a new window. Leave it up to the user to decide
how to display the image.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jun 27 '06 #2
Helmut Giese wrote:
Hello out there,
I know that I can replace an image with another using e.g.
onMouseOver="sw apIn(...)"
and
onMouseOut="swa pOut(...)"

Is there anything I can do if Javascript is disabled?

- I guess I could use 'noscript' to provide a link which opens an
external window to display the second image'


What's the purpose of the rollover when JS is enabled? Is it just a
presentational enhancement or is the rollover image really meaningful
content? If it's just presentational, it doesn't matter if it's not
shown to some users and it's certainly not worth linking to separately.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Jun 28 '06 #3
On Tue, 27 Jun 2006 22:09:55 +0100, Steve Pugh <st***@pugh.net > wrote:

Hi Steve,
I know that I can replace an image with another using e.g.
onMouseOver="sw apIn(...)"
and
onMouseOut="swa pOut(...)"

Is there anything I can do if Javascript is disabled?


If it's a background images then you can change it via :hover in CSS.

No, it's part of the presentation. Hm, could a table have a background
image which would then change via :hover in CSS? Probably not.
- I guess I could use 'noscript' to provide a link which opens an
external window to display the second image'
- any other possibilty?


Just link to it normnally as the standard, then add JavaScript on top
of that. Starting with the JS gizmos and then adding the basics is
almost always the wrong way round.

Well, the assumption here is that Javascript is disabled.
On a related note: Is it possible (without Javascript) to open a new
window giving its dimension and omitting the usual "decoration s"

No.

Too bad.
it is for displaying a small image which looks ridiculous if a "normal"
window would open.


Then don't open it in a new window. Leave it up to the user to decide
how to display the image.

It's a relatively small window (350 x 350) being part of a rather
large page. Displaying the second image in the same window would
completely lose the context, while showing it in a separate (smaller)
window would retain it.
But, well, if the technology doesn't allow it, then so be it.
Thanks for the info and best regards
Helmut Giese
Jun 28 '06 #4
On Wed, 28 Jun 2006 11:54:46 +1000, Lachlan Hunt
<sp***********@ gmail.com> wrote:

Hi Lachlan,
What's the purpose of the rollover when JS is enabled? Is it just a
presentation al enhancement or is the rollover image really meaningful
content? If it's just presentational, it doesn't matter if it's not
shown to some users and it's certainly not worth linking to separately.

No, it's the central part of the message. Something like
This is how things are now.
Move the mouse over the image to see
how it could be like. :)
So I would like to find a way to present it in a meaningful way even
if Javascript is disabled.
Best regards
Helmut Giese
Jun 28 '06 #5
Helmut Giese wrote:
On Tue, 27 Jun 2006 22:09:55 +0100, Steve Pugh <st***@pugh.net > wrote:

Hi Steve,
I know that I can replace an image with another using e.g.
onMouseOver="sw apIn(...)"
and
onMouseOut="swa pOut(...)"

Is there anything I can do if Javascript is disabled?
If it's a background images then you can change it via :hover in CSS.>


No, it's part of the presentation.


But in your reply to Lachlan you said "No, it's the central part of the
message." Which is it? Presentation or content? If its content then
keep it in the HTML and don't make it a background image.

Based on what you say there "This is how things are now.
Move the mouse over the image to see
how it could be like. :)"
I would suggest putting both images in the page as normal content and
letting the user see them side by side rather than only having one
visible at a time. Especially for users without a mouse...
Hm, could a table have a background
image which would then change via :hover in CSS? Probably not.


Of course.

Shame about IE which only supports :hover on links.
- I guess I could use 'noscript' to provide a link which opens an
external window to display the second image'
- any other possibilty?


Just link to it normally as the standard, then add JavaScript on top
of that. Starting with the JS gizmos and then adding the basics is
almost always the wrong way round.


Well, the assumption here is that Javascript is disabled.


If that's the assumption then don't use JavaScript at all.

My advice was based on the assumption that some people would have
JavaScript and some people wouldn't.
it is for displaying a small image which looks ridiculous if a "normal"
window would open.


Then don't open it in a new window. Leave it up to the user to decide
how to display the image.


It's a relatively small window (350 x 350) being part of a rather
large page. Displaying the second image in the same window would
completely lose the context, while showing it in a separate (smaller)
window would retain it.


One click to close popup.
One click to go back to previous page.

No difference in getting back to the "context".

Steve

Jun 28 '06 #6
Helmut Giese wrote:
On Wed, 28 Jun 2006 11:54:46 +1000, Lachlan Hunt
<sp***********@ gmail.com> wrote:
What's the purpose of the rollover when JS is enabled? Is it just a
presentational enhancement or is the rollover image really meaningful
content? If it's just presentational, it doesn't matter if it's not
shown to some users and it's certainly not worth linking to separately.


No, it's the central part of the message. Something like
This is how things are now.
Move the mouse over the image to see
how it could be like. :)
So I would like to find a way to present it in a meaningful way even
if Javascript is disabled.
Best regards
Helmut Giese


You could try something like this:

<a href="more-info" class="before-after">
<img src="before.jpg " class="before" alt="...">
<img src="after.jpg" class="after" alt="...">
</a>

a.before-after img.after { position: absolute; left: -2000px; }

a.before-after:hover img.before,
a.before-after:focus img.before { position: absolute; left: -2000px; }

a.before-after:hover img.after,
a.before-after:focus img.after { position: static; }

You could use display: none; instead of positioning them off screen, but
then, unfortunately, broken screen readers wouldn't read the alt text.

That way, no javascript is required at all. It should work in IE and
users with CSS disabled still get both images.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Jun 28 '06 #7
Hi Steve and Lachlan,
I want to thank you both for your suggestions, but more urgent things
have come up :(
Actually I am a software developer helping out on the HTML front line,
but currently one of my programs gives us or rather a customer some
headaches, so I have to concentrate on this issue.
I'll be back as soon as this will be resolved.
Best regards
Helmut Giese
Jun 29 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6166
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up the faults that might go with the suggestion... all opinions welcome. My question: I have a list of links that go to pages that have a similar layout. Could I have a text swap, similar to what I've seen with image swaps (or an image switch)...
2
1559
by: Frank Bishop | last post by:
I have been trying to do image swaps and my second image does not show up, it just goes to a blank image on the mouseover. I have Windows XP SP2 and it prompts me to allow blocked content when the page loads and then I do allow. But the swap still does not show up, just the first image. Also, is there a more advanced example that has multiple swap buttons in a menu (maybe in an array)? Help appreciated. <code> <head> <title>Cool...
4
4232
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however I would really like to use linked images instead to do the following: - When open.gif is clicked, the contents of the div show and open.gif is swapped with close.gif - subsequently, when close.gif is clicked, the div contents get hidden
12
1653
by: LAshooter | last post by:
I have a portfolio page which loads a dozen thumbnails and one large image. A friend helped me code a script (below) which will swap out the large image (named "imgLarg") when a different thumbnail is clicked. Both the thumbnail and the enlargement are identically named, one is in /thumbs/ and one is in /enlargements/ - tricky, huh? ;-) What's the easiest way to make this work in other browsers as well? <script language="JavaScript">...
6
3197
by: Karl | last post by:
Hi, Ok so on a given page I have 4 text links: see it in black see it in blue see it in red see it in green using the standard swap image behavior, clicking on one of the above links
5
2796
by: Ed Jay | last post by:
Why doesn't the following swap images? <head> <javascript type="text/javascript"> function swapImage() {document.images.image1.src=/images/1stimage.gif;} function swapBack() {document.images.image1.src=/images/2ndimage.gif;} </script> </head><body> <a href=url onMouseOver=swapImage(); onMouseOut=swapBack();>
3
2695
by: steve.peticca | last post by:
Hi, My onmousevent fails to switch the large photo with one of the smaller images. To be frank, I'm extremely new to Javascript programming and as such, am trying to learn from other sites out there for sample code. I can't see to determine the error. first image. (all images have the same problem.)
3
2023
by: PEJO | last post by:
I'm not much of a JS programmer so I used the the standard Macromedia swap image function for a disjointed rollover..which works fine.. no problem swapping the image with that code.... but when I add the following to the onMouseOver to the thumbnail: onMouseOver="Product_Link.href='http://glasstoilets.com/catalog/tank1-p-28.html'; and this to the full size...
5
13379
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10007
jinu1996
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...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
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();...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.