summaryrefslogtreecommitdiff
path: root/inventory/media/javascript/components/slider/examples/example4.html
blob: 4498f72fb64b950aef332108e0c9ae560e9d4523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>JavaScript Bs_Slider example 1</title>

<style>
  .sliderInput {
  	height:20;
    width:30;
  	font-family : Arial, Helvetica, sans-serif;
  	font-size : 12px;
  }
</style>

<script type="text/javascript" src="/_bsJavascript/lib/LibCrossBrowser.js"></script>
<script type="text/javascript" src="/_bsJavascript/lib/EventHandler.js"></script>
<script type="text/javascript" src="/_bsJavascript/core/form/Bs_FormUtil.lib.js"></script>
<script type="text/javascript" src="/_bsJavascript/components/slider/Bs_Slider.class.js"></script>
<script><!--
function init(){
  mySlider = new Bs_Slider();
  mySlider.attachOnChange(bsSliderChange);
  mySlider.width         = 121;
  mySlider.height        = 26;
  mySlider.minVal        = 1;
  mySlider.maxVal        = 10;
  mySlider.valueInterval = 1;
  mySlider.arrowAmount   = 1;
  mySlider.valueDefault  = 5;
  mySlider.imgDir   = '/_bsJavascript/components/slider/img/';
  mySlider.setBackgroundImage('bob/background.gif', 'no-repeat');
  mySlider.setSliderIcon('bob/slider.gif', 13, 18);
  mySlider.setArrowIconLeft('img/arrowLeft.gif', 16, 16);
  mySlider.setArrowIconRight('img/arrowRight.gif', 16, 16);
  mySlider.useInputField = 2;
  mySlider.styleValueFieldClass = 'sliderInput';
  mySlider.draw('sliderDiv1');
}

/**
* @param object sliderObj
* @param int val (the value)
*/
function bsSliderChange(sliderObj, val, newPos){ 
	var img = document.getElementById('smiley');
	img.src = "/_bsJavascript/components/slider/img/smiley/happyMode/happy" + parseInt(val) + ".gif";
}
// --></script>

</head>
<body bgColor="white" text="#3366aa" link="#0000ee" alink="#ff0000" vlink="#551a8b" onLoad="init();">

<h1>JavaScript Bs_Slider example 4 - Smiley</h1>

This example is very similar to example 1 with an attached onChange event. <br>
Only the output of the selected value is much cooler :-)<br><br>

<hr>
<br>
<table border="0" cellspacing="0" cellpadding="0" width="250">
  <tr>
    <td width="200" valign="top"><div id="sliderDiv1"></div></td>
    <td width="50" valign="top">
      <img id="smiley" src="/_bsJavascript/components/slider/img/smiley/happyMode/happy3.gif">
    </td>
  </tr>
</table>
</body></html>