Integrate functions

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

adasiax
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jun 09, 2013 8:03 am

Integrate functions

Postby adasiax » Sun Jun 09, 2013 8:08 am

I have 4 functions which are changing four different parameters by sliders. But when i change them one after another every parameter is changing without including 3 left. I 've added a function UpdateImage which will read the current value of each slider. Then have all sliders just call that function whenever they change. But i have some errors. Can someone help? Here is the code:



Code: Select all

<html>
<body>
<head>
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>



<script text="text/javascript">





$(function(){
$('#T1Slider').slider({
change: function(){
var T1 = $(this).slider('option','value')
$('#lissajousOutput').attr('src', 'lissajous.php?T1='+T1)

}
});
});
</script>

<script text="text/javascript">
$(function(){
$('#T2Slider').slider({
change: function(){
var T2 = $(this).slider('option','value')
$('#lissajousOutput').attr('src', 'lissajous.php?T2='+T2)
}
});
});
</script>

<script text="text/javascript">
$(function(){
$('#a1Slider').slider({
change: function(){
var a1 = $(this).slider('option','value')
$('#lissajousOutput').attr('src', 'lissajous.php?a1='+a1)
}
});
});
</script>

<script text="text/javascript">
$(function(){
$('#a2Slider').slider({
change: function(){
var a2 = $(this).slider('option','value')
$('#lissajousOutput').attr('src', 'lissajous.php?a2='+a2)
}
});
});



</script>

<script>
function UpdateImage(){
  var T1 = $('#T1Slider').slider('option', 'value');
  var T2 = $('#T2Slider').slider('option','value');
var a1 = $('#a1Slider').slider('option','value');
  var a2 = $('#a2Slider').slider('option','value');
 
 
  var url = 'lissajous.php?T1=' +  T1  +T2  +a1  +a2  ;

 
  $('#lissajousOutput').attr('src', url);
}

$('#T1Slider').slider({
   change: UpdateImage();
});

$('#T2Slider').slider({
   change: UpdateImage;
});

$('#a1Slider').slider({
   change: UpdateImage;
});

$('#a2Slider').slider({
   change: UpdateImage;
});
</script>


<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
</head>


<center><img src="lissajous.php" id="lissajousOutput"></center>
</br></br>
<center>T1<div name="T1" style="width: 800px; " id="T1Slider"></div></center>
<br>

<center>T2<div name="T2" style="width: 800px; " id="T2Slider"></div></center>
<br>

<center>a1<div name="a1" style="width: 800px; " id="a1Slider"></div></center>
<br>

<center>a2<div name="a2" style="width: 800px; " id="a2Slider"></div></center>

</body>
</html>

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests