navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Javascript Random Images

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Accessibility >> Javascript Random Images
Page: [1]
 
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
Javascript Random Images - 8/25/2005 0:38:55   
Hello, I was wondering if using Javascript for random images would effect accessibility at all? Basically all I want to do is swap images on page load (the images are only for 'pretty' and not for content).

Have read through Creating Accessible JavaScript and think it will be okay if I use alt="", but am not 100% sure.

Have found some articles on doing this without Javascript, but they all use server side scripting and I'd rather keep this as html.

Thanks for any advice :)

Sally
Tailslide

 

Posts: 6046
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Javascript Random Images - 8/25/2005 3:19:12   
Hi Sally

As long as it's "just for pretty" stuff I'd say you're ok. I'd use the alt="" for images that that are structural for instance lines or bullets or for something that would generally be more confusing and annoying than enlightening for someone using a text reader.

I tend to include structural images in the CSS and they don't have any sort of Alt tag so I guess you're effectively doing the same thing. I've no idea what Alt="" will do to your validation if you do that though!


_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to rubyaim)
jaybee

 

Posts: 14157
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Javascript Random Images - 8/25/2005 5:48:52   
If you're using a <script> tag anywhere in your code you should also use a <noscript> tag for browsers without js.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Tailslide)
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
RE: Javascript Random Images - 8/25/2005 19:06:05   
Tailslide, thanks for your input, it is much appreciated :)

It's company policy that all pages meet WAI-A at least. I generally don't find this too difficult but with things like this Javascript I sometimes get a bit confused.

The alt="" validates when tested outside of the Javascript, but at this stage my actual Javascript does not, am having trouble with the alt, height and width in the document.write :) Back to the drawing board I guess.

Jaybee, thanks - yes I always use <noscript>. It's easy to forget though so I added it to the Code Snippets in FrontPage a while ago.

Sally

(in reply to Tailslide)
Tailslide

 

Posts: 6046
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Javascript Random Images - 8/26/2005 3:03:09   
Sally

What exactly is it falling down on because I've got this sort of thing to work in the past at xhtml 1.0 strict?

I find that commenting the script out like this helps too (sorry if you're already doing it!):

<script type="text/javascript">
//<![CDATA[
document.write('blah blah')
 //]]>
</script>


Or if it's still causing you problems then can you remove the script itself to an external .js file?

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to rubyaim)
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
RE: Javascript Random Images - 8/28/2005 19:49:51   
Hi - sorry for late reply - had a lovely 'computer free' weekend :)

I looked at this first thing this morning and realised straight away that I'd not put in "\" :)

So, the below is validating (XHTML 1.0 Transitional)

img width=\"80\" height=\"80\" alt=\"\" border=\"0\"

Thanks again for your advice :)

Sally

(in reply to Tailslide)
khai87

 

Posts: 15
Joined: 10/14/2005
From: Singapore
Status: offline

 
RE: Javascript Random Images - 10/14/2005 21:13:37   
Hey there,

I just wanna know, if i want to include the the image and the links plus the text on that random image. How would the code be cos i know rank image plus link only, its like this

images[3] = "<a href = 'http://www.computerhope.com/history/newslet.htm'><img src='http://www.computerhope.com/banners/banner5.gif' alt='Computer Hope Newsletter'></a>";

i hope that you guys can help me on how to include the text after that random image and link.

(in reply to rubyaim)
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
RE: Javascript Random Images - 10/16/2005 19:12:26   
Hi, you should be able to include your text along with the image path and link like:

image[1]= "<a href=\"http://www.computerhope.com/history/newslet.htm\"> <img src=\"http://www.computerhope.com/banners/banner5.gif\" alt=\"Computer Hope Newsletter\"></a> <p>Here is some text.</p>"; 


Is that what you are after?

_____________________________

Sally

(in reply to khai87)
khai87

 

Posts: 15
Joined: 10/14/2005
From: Singapore
Status: offline

 
RE: Javascript Random Images - 10/17/2005 6:47:34   
Alright, yeay. Thanks a million. I appreciate it!

(in reply to rubyaim)
Page:   [1]

All Forums >> Web Development >> Accessibility >> Javascript Random Images
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts