PDA

View Full Version : Slider in JS or dhtml


ez4ne12c
09-24-2002, 09:55 PM
I need somthing like a slider ranging from 0 to 100
anyone seen anything like this in JS or DHTML?
Thanks in advance
ez:)

Mr J
09-24-2002, 11:11 PM
Something like this:

Change the images to yours and add to the array



<HTML><HEAD><TITLE>Document Title</TITLE></HEAD><BODY>

<SCRIPT language="javascript">
<!--
newTrans=new Array()
newTrans[newTrans.length] = "progid:DXImageTransform.Microsoft.Slide(bands=1, slidestyle='swap')";
newTrans[newTrans.length] = "progid:DXImageTransform.Microsoft.Slide(bands=1, slidestyle='push')";

photos1=new Array()
photos1[photos1.length]="Img1.jpg"
photos1[photos1.length]="Img2.jpg"
photos1[photos1.length]="Img3.jpg"
photos1[photos1.length]="Img4.jpg"
photos1[photos1.length]="Img5.jpg"
photos1[photos1.length]="Img6.jpg"
photos1[photos1.length]="Img7.jpg"

var preloadpics=new Array() // preloads images
for (i=0;i<=photos1.length-1;i++) {
preloadpics[i]=new Image()
preloadpics[i].src=photos1[i]
}

var tranSpeed = 1.0; // how long transition takes in seconds
var pause = 1000 // in milliseconds
var advance = (tranSpeed*1000)+pause //
var Running = 0;
var i=0
var picnum1=1

function RunMe(){
if (Running == 1){return}
Running = 1;

divA.style.filter = newTrans[0];
divA.filters[0].apply();
divA.innerHTML = "<img src='"+photos1[picnum1]+"'width='"+document.all.divA.style.width+"'height='"+document.all.divA.style.height+"'>"

if(i==newTrans.length -1){
i=-1}

if(picnum1==photos1.length-1){
picnum1=0}

divA.filters[0].play(tranSpeed);
picnum1++

i++
setTimeout("Running=0",tranSpeed*1000)

//setTimeout("Pre_Run("+n+")",advance)
}


// -->
</SCRIPT>

<DIV id=divA onfilterchange="" style="position:absolute; left:50; top:50px; width:300; height:300; filter(); border:5 inset blue;cursor:hand" ><img src="Img.jpg" width=300 height=300>
</DIV>
<form>
<input type="button" value="Change" onclick="RunMe()">
</form>
</BODY>
</HTML>

Mr J
09-24-2002, 11:12 PM
PS

Where the :D is it should be a semicolon

ez4ne12c
09-24-2002, 11:28 PM
:)Hey thats cute! :(but not what i had in mind..
oh i hope you dont mind if i store that one away for later...

What i meant was a slider like a volume control....
I guess i could try an image map with innerHTML somehow but i thought someone may have seen what i want somewhere?

Thanks anyways

Anyone??

ez

nolachrymose
09-24-2002, 11:52 PM
You might want to check out jkd's slider widget: http://codingforums.com/showthread.php?s=&threadid=3335

Hope that helps!

Happy coding! :)

ez4ne12c
09-25-2002, 12:28 AM
Tried the link to example but was blocked so i followed instructions.. i'm gettin a blank page when i do this
any ideas?

<html xmlns:rdhtml="http://rdhtml.resource-locator.com/xmlns" >
<?import namespace="rdhtml" implementation="slider.htc"?>

<head>
<style type="text/css">
rdhtml\:slider
{ -moz-binding: url(slider.xml#slider);
-moz-user-focus: normal;
-moz-user-input: enabled;
display: block;
padding: 0;
margin: 0;
position: relative;
}
</style>

</head>
<body>
<rdhtml:slider width=100 onvaluechange="alert('hi there')"></rdhtml:slider>

</body>

</html>


Thanks
ez
:confused:

adios
09-25-2002, 12:32 AM
http://www.dynamicdrive.com/dynamicindex11/dhtmladjust.htm

ez4ne12c
09-25-2002, 12:40 AM
:cool: Thats exactly what i was after
thank you all for help (again)
ez

ez4ne12c
09-25-2002, 01:03 AM
Oh btw doent work in NS4.7 for me... but im using IE anyways
ez