suzie Posted June 25, 2010 Share Posted June 25, 2010 Dear,I have a div, and am using javascript function to get the height of this Div:<script language="JavaScript"> <!-- function autoResize(DivID){ var DivHeight = document.getElementById(DivID).clientHeight}//--> </script>Now if the DivHeight is = 873 i want to call services.phpelse to call services-index.php...I did that:<script language="JavaScript"> <!-- function autoResize(DivID){ var DivHeight = document.getElementById(DivID).clientHeight if (DivHeight = 873) { <?php include"services.php"; ?> } else {<?php include"services-index.php"; ?> }}//--> </script> these two .php file locate the footerbut this way doesn't work and the footer doesn't appearis there a way please???any help Link to comment Share on other sites More sharing options...
Synook Posted June 25, 2010 Share Posted June 25, 2010 You can't mix JavaScript and PHP together like that, because the execute at different times and in different contexts - you will have to use AJAX. Link to comment Share on other sites More sharing options...
suzie Posted June 25, 2010 Author Share Posted June 25, 2010 ah, a new to Ajax, How I can use it...can you give me more detail please... Link to comment Share on other sites More sharing options...
boen_robot Posted June 25, 2010 Share Posted June 25, 2010 ah, a new to Ajax, How I can use it...can you give me more detail please...The basic idea is to use JavaScript to send a new HTTP request. The server may then execute PHP, and output something based on the contents of the request. That output can be caught by JavaScript, and once it's there, you can do whatever you want with it.See the AJAX tutorial for details on how to do it. Make sure not to skip the diagram... just in case. Link to comment Share on other sites More sharing options...
Synook Posted June 25, 2010 Share Posted June 25, 2010 Also, the condition here is wrong: if (DivHeight = 873) You may want the equivalence operator ==, or maybe an inequality (> or <)? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.