Jump to content

Recommended Posts

I have 4 functions which are changing four different parameters. But when i change them one after another every parameter is changing without including 3 left. How can i change that? Here is the code:

<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>


<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>
Link to comment
https://forums.phpfreaks.com/topic/278963-integrate-functions/
Share on other sites

Create another function called UpdateImage which will read the current value of each slider. Then have all your sliders just call that function whenever they change.

function UpdateImage(){
  var T1 = $('#T1Slider').slider('option', 'value');
  ...

  var url = 'lissajous.php?T1=' + T1 ...;
  $('#lissajousOutput').attr('src', url);
}

$('#T1Slider').slider({
   change: UpdateImage;
});
Edited by kicken
Link to comment
https://forums.phpfreaks.com/topic/278963-integrate-functions/#findComment-1434998
Share on other sites

Create another function called UpdateImage which will read the current value of each slider. Then have all your sliders just call that function whenever they change.



function UpdateImage(){
  var T1 = $('#T1Slider').slider('option', 'value');
  ...

  var url = 'lissajous.php?T1=' + T1 ...;
  $('#lissajousOutput').attr('src', url);
}

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

Is that function correct? 



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;
});
Edited by Adasiax
Link to comment
https://forums.phpfreaks.com/topic/278963-integrate-functions/#findComment-1435001
Share on other sites

Is that function correct? 

var url = 'lissajous.php?T1=' + T1 + T2 + a1 + a2;

 

That is not going to generate the proper URL. You need to generate a URL that looks like this:

 

lissajous.php?T1=##&T2=##&a1=##&a2=##

where ## is the value from the slider.

 

To do that you need to concatenate strings and the variables together using the + operator.

Link to comment
https://forums.phpfreaks.com/topic/278963-integrate-functions/#findComment-1435012
Share on other sites

That is not going to generate the proper URL. You need to generate a URL that looks like this:

 

lissajous.php?T1=##&T2=##&a1=##&a2=##

where ## is the value from the slider.

 

To do that you need to concatenate strings and the variables together using the + operator.

O my god ;p You mean somethign like this?    



var url = 'lissajous.php?T1'+'='+'##'+'&T2'+'='+'##'+'&a1'+'='+'##'+'&a2'+'='+'##' ;



			
				


	Edited  by Adasiax
	
	

			
		
Link to comment
https://forums.phpfreaks.com/topic/278963-integrate-functions/#findComment-1435017
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.