Javascript Slider to Update TextBox

Hello,

I've created a calculator in excel and then used another product to convert the excel into javascript html. The problem is that I've altered the html to include sliders however when i use the slider it doesn't auto update the textbox unless a radio button is clicked.  Just wondering if there is a an attribute(s) that need to be altered.

Not sure if its against rules to provide a link to the calculator but here it is..

http://www.cronicco.com

Many thanks.
gindoAsked:
Who is Participating?
 
scooby_56Commented:
hi,

On-click of the radio buttons calls recalc_onclick()

You could try adding a call to this from inside the f_sliderMouseUp() function in slider.js



function f_sliderMouseUp (e_event, b_watching) {
	if (window.n_activeSliderId != null) {
		var o_slider = window.A_SLIDERS[window.n_activeSliderId];
		o_slider.f_setValue(o_slider.n_minValue + (o_slider.b_vertical
			? (o_slider.n_pathLength - parseInt(o_slider.e_slider.style.top) + o_slider.n_pathTop)
			: (parseInt(o_slider.e_slider.style.left) - o_slider.n_pathLeft)) / o_slider.n_pix2value);
		if (b_watching)	return;
		window.n_activeSliderId = null;
	
        //New call here
        recalc_onclick();

}
	if (window.f_savedMouseUp)
		return window.f_savedMouseUp(e_event);

        
}

Open in new window

0
 
leakim971PluritechnicianCommented:
Hello gindo,

Include this script in the head of your page for example :


<script language="javascript">
	window.onload = function() {
		document.getElementById("pA9E1").setAttribute("onmouseup", "before_recalc_onclick()");	
		document.getElementById("pA9E2").setAttribute("onmouseup", "before_recalc_onclick()");	
		document.getElementById("pA9E3").setAttribute("onmouseup", "before_recalc_onclick()");	
	}
	function before_recalc_onclick() {
		if(document.getElementById("pA9E1").checked) {
			recalc_onclick(document.getElementById("pA9E1"));
		}
		else if(document.getElementById("pA9E2").checked) {
			recalc_onclick(document.getElementById("pA9E2"));
		}
		else if(document.getElementById("pA9E3").checked) {
			recalc_onclick(document.getElementById("pA9E3"));
		}
	}
</script>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.