|
|
sideout
Bipolar (III) Inmate
From: Hull, Que, Can Insane since: Feb 2004
|
posted 02-14-2004 18:50
I want to diasplay a series of about six product images randomly on on a home page.
I not sure how to go about doing it, whats the best way using javascript?
All help appreciated,
thanks,
sideout
|
HZR
Bipolar (III) Inmate
From: Cold Sweden Insane since: Jul 2002
|
posted 02-14-2004 19:24
Use something server-side instead.
|
hyperbole
Paranoid (IV) Inmate
From: Madison, Indiana, USA Insane since: Aug 2000
|
posted 02-14-2004 21:04
You can actually do this using JavaScript.
Place a list of the URIs of the images you want to display in an array.
in your HTML at the location you want to display the image put in a line like the following:
document.write("<img src='"+array[random_value].ur+"'>");
That will cause a random image to be displayed each time the page is refreshed.
-- not necessarily stoned... just beautiful.
[This message has been edited by hyperbole (edited 02-14-2004).]
|
HZR
Bipolar (III) Inmate
From: Cold Sweden Insane since: Jul 2002
|
posted 02-14-2004 22:06
Yea, of course you can do it with JavaScript, but some people disable JS or is using a browser that doesn't support it, thus won't see anything.
|
JKMabry
Maniac (V) Inmate
From: out of a sleepy funk Insane since: Aug 2000
|
posted 02-14-2004 22:48
the 5% of people that don't have js capabilities for wahetevr reason, do not deserve to see pretty pictures! IMHO =)
<!--I pity the foo cain't see no javascrip!
//-->
|
HZR
Bipolar (III) Inmate
From: Cold Sweden Insane since: Jul 2002
|
posted 02-15-2004 10:49
quote: the 5% of people that don't have js capabilities for wahetevr reason, do not deserve to see pretty pictures!
I just can't see the logic in that.
|
Steve
Maniac (V) Inmate
From: Boston, MA, USA Insane since: Apr 2000
|
posted 02-15-2004 13:37
This from AListApart: Image Rotator is simple and it simply works.
|
JKMabry
Maniac (V) Inmate
From: out of a sleepy funk Insane since: Aug 2000
|
posted 02-15-2004 16:36
quote: I just can't see the logic in that.
but you see the humor right?
|
smonkey
Paranoid (IV) Inmate
From: Northumberland, England Insane since: Apr 2003
|
posted 02-15-2004 17:33
minority groups are a pain in the arse.
basically if you are making a pretty gallery/picture site then any user that comes to said site without javascript or css enabled is being stoopid.
sure we can make sites that work for the decrepit old browsers or for users with disabled scripts and css but at the end of the day it sucks to pander to the old days extremely low fi market.
make something good that uses script or css or latest xhtml or whatever and if it doesn't work for a few people maybe they will upgrade their stinking old shitpit of a browser or try to overcome their paranoia about javascript.
by pandering to minority groups we perpetuate the problem of the old skool, old style, web - we are moving on to newer better things and I for one want to riding as close to the front as possible.
by the way - I do believe in good accessibility, that is a different issue - sites should alway try to provide usable functionality for the deaf, blind, partially sited, colour blind etc. That said it is often very difficult to do this, so it's a good job screen readers are getting better at reading 'normal' sites to some level of clarity.
sorry for the rant
<A HREF="http://www.cryokinesis.co.uk" TARGET=_blank>visit
|
HZR
Bipolar (III) Inmate
From: Cold Sweden Insane since: Jul 2002
|
posted 02-15-2004 18:07
quote: basically if you are making a pretty gallery/picture site then any user that comes to said site without javascript or css enabled is being stoopid.
HUH?
quote: and if it doesn't work for a few people maybe they will upgrade
Or maybe they can't
quote: by the way - I do believe in good accessibility
A page that requires JavaScript to work can never be accessible.
This is what I've learned and what I agree with.
JavaScript is only the behavioral layer on a page (just like CSS is the presentational) -- it adds functionality, but the page should work fully without it. When building a site, don't rely on scripting for it to work. That is "stoopid".
quote: but you see the humor right?
Almost
|
hyperbole
Paranoid (IV) Inmate
From: Madison, Indiana, USA Insane since: Aug 2000
|
posted 02-15-2004 20:13
JK : I see the humour in it
Steve: That was a great link on this topic.
<rant>
HZR: I have been working with computers for thirty five years and there has always been someone in the background kicking their feet and screaming that the new way of doing things is going to break their old way of doing things and the rest of the world can't progress because they don't want it to.
Get over it.
Move on or be left behind. Yes it would be nice to pander to that 2% or 5% or 15% who want to continue to use the old technology or are scared that turning JavaScript on will allow the rest of the world to get access to their computer so they turn it off. I agree that we should try to design pages that will degrade gracefully. I agree that we should work on building community so that all people feel important and included and as if others care. BUT, at some point one has to make a dollar. At some point we also have to let the people who have new and different ideas have their way some of the time. At some point we have to take steps forward to new and different technologies. All the kicking and screaming of a few people who don't want to (or can't) progress won't stop it.
I personally like Netscape 4.7. I have had to move on to IE6 and Ntescape 7.0 and will soon move on to Firebird. This doesn't mean that I don't still like the design of 4.7. The world has moved on and I have to make the decision to move with it or stick to my older browser and not complain about the new pages I can't view with it (I actually find myself using 4.7 to view pages that won't display in 7.0 because about 10% of modern pages won't display in NS7 but will in NS4.7).
Move on the world is moving to CSS and JavaScript and XHTML etc. Join the rest of us. Have some fun. Stop throwing tantrums about the fact that the new technologies break because you have turned off JavaScript.
</rant>
-- not necessarily stoned... just beautiful.
|
Cameron
Bipolar (III) Inmate
From: Brisbane Insane since: Jan 2003
|
posted 02-17-2004 19:50
Yah, I have to agree that not using JavaScript because some people might not be able to use it is absurd.
How about not building a web page at all because some people might not have a computer to view it with?
I'd also like to point out that JavaScript can greatly enhance the accessibility and usability of a website. It would be nice if all of our pages could downgrade to a usable point for browsers back to the early mosaic days, and when it does it's kinda nice but I honestly don't see why we should be catering to such outdated technology.
Game developers target their games to the mainstream market, not aging 386's and Apple II's, as do operating systems and just about every other piece of computer software. Upgrading is simply a life long routine in all aspects of technology and it should be no different with web sites.
quote: JavaScript is only the behavioral layer on a page
In regards to that, you shouldn't believe everything you read. I too read that article on ALA, and was appalled with it (as with many others I've read there of late). It did nothing but tried to put JavaScript into a box fit for any standards evangelist, to be kept at arms length so it would be easier to deal with and to justify its lack of utilisation. The examples presented were also possible many years ago in pretty much all JavaScript supporting browsers, making the whole argument a little pointless as many people were already doing this. Additionally, the author missed some rather important issues currently plaguing website usability across the net that can be rectified quite elegantly with JavaScript.
The key to knowing when and where you should use JavaScript is in weighing up the pros and cons against your target market and the kind of content you are providing. To be honest, I think a lot of the negativity surrounding JavaScript is holding back potential gains in usability of many websites. Although, this is mostly for web applications like forums, web based email clients and the like, which are miles behind native OS applications in terms of usability mainly due to an under utilisation of dynamic environment scripting.
But hey, if you want to live in the dark ages then by all means, be my guest.
|
HZR
Bipolar (III) Inmate
From: Cold Sweden Insane since: Jul 2002
|
posted 02-17-2004 21:49
quote: In regards to that, you shouldn't believe everything you read. I too read that article on ALA
I really don't know what you're talking about here, it seems that you are drawing the conclusion that I've read some article on ALA were I read something like that. I haven't and I rarely read anything posted there, because most of the articles are very bad IMHO. (edit: URL for the article?)
quote: I'd also like to point out that JavaScript can greatly enhance the accessibility and usability of a website.
Sure. But it can break accessibility too, when sites are relying on JavaScript for it to work.
quote: if you want to live in the dark ages
It's not only old browers that doesn't handle JavaScript though, modern browsers for cellphones is one example where JavaScript is not always supported.
And just to clear things up, I'm not all negative about JavaScript as some of you seems to believe, I only think that a server-side solution might be best in this particular case, or do you have anything against it?
[This message has been edited by HZR (edited 02-17-2004).]
|
Cameron
Bipolar (III) Inmate
From: Brisbane Insane since: Jan 2003
|
posted 02-18-2004 02:39
Sorry about assuming you read that article. It's just that you used the exact same sentence as the author so I assumed you picked it up form there. My bad. I was also very tired and in a kinda shitty mood last night when I posted that, sorry if I come off as a being rather offensive as that wasn't my intention.
Server side solutions are all well and good if you have access to them, yet many web designers simply don't. If this is the case then a JavaScript solution would suffice, and would likely be easier to do in the first place. But I agree that if you have the ability to do this server side then it would be better to do thigs there.
Cell phones are a whole other kettle of fish in my book. I don't think anyone should be grouping then in the same breath as web browsers. I've yet to see a website properly designed to offer a decent full screen browser and cell phone experience from the one (X)HTML page. The idea is noble but so completely unpractical if you want to deliver quality content targeted towards such obviously different audiences and platforms.
I've seen some websites that do okay at supporting PDA's was well as fully featured browsers (the Opera website being one a good example of this, and it should be seeing as opera can be used on PDA's) but cell phones are even smaller with even less control, screen space, processing power and that have such a minimal ammount of bandwidth. This is what XML and XSLT should be employed to handle. CSS wasn't designed to nor is it really powerful enough to scale information over that broad a range, it's meant for presentation control not information scoping, but XSL(T) was designed for this task. Even then, you'd only really bother going to those lengths if you actually thought your website would potentially be visited by people using a mobile phone. And given the lack of client support for XSLT you'd definatly want to employ server side solutions for this.
If the site is targeted towards the average internet user with a web browser, JavaScript shouldn't be a problem. It's also possible to provide a JavaScript solution for this problem that doesn't break in older browsers providing you use a default image and then you can change it onload. Simple problem, simple solution.
Six of one, half a dozen of the other....
|
Alevice
Paranoid (IV) Inmate
From: Mexico Insane since: Dec 2002
|
posted 02-18-2004 03:48
The argument is interesting, but none seems to have provided a solution for the question so far
Hopefully sideout is still around, and will check this :
var url = "http://url.to/the/file/";
howmany = 10 //just put the number of files taht will be used
if (document.images) {
pic = new Array(howmany);
for (m=0; m<howmany; m++) {
pic[m] = new Image(); }
pic[0].src = url + "01.gif";
pic[1].src = url + "02.gif";
pic[2].src = url + "03.gif";
pic[3].src = url + "04.gif";
pic[4].src = url + "05.gif";
pic[5].src = url + "06.gif";
pic[6].src = url + "07.gif";
pic[7].src = url + "08.gif";
pic[8].src = url + "09.gif";
pic[9].src = url + "10.gif";
}
var rand = (Math.round(Math.random()*(pic.length - 1)));
document.write("<img src='" + pic[rand].src + "' border='0' />");
Notice this code can be somewhat bloated tho. I am still not very literate on coding
__________________________________
Sexy Demoness cel
[This message has been edited by Alevice (edited 02-18-2004).]
|
Cameron
Bipolar (III) Inmate
From: Brisbane Insane since: Jan 2003
|
posted 02-24-2004 17:09
Dang it, I have no idea why I was such an ass last week. Must have been the heat wave. FWIW, I apologise for getting overly testy for no real reason.
|
HZR
Bipolar (III) Inmate
From: Cold Sweden Insane since: Jul 2002
|
posted 02-24-2004 18:17
|