I am using cakephp and trying to define this in the script of ctp file. The output is also coming right with it.
if(window.location开发者_如何学C.pathname="/users/register"){
$('body').css('position', 'relative');
$('#footer').css('bottom', '0px');
$('#footer').css('position', 'absolute');
}
But the problem is the page keeps on constant reloading automatically when the defined pathname is visited. Is there any way to stop reloading continuously. The usage of this is requierd for proper output.
use == (comparison) instead of = (assignment) :)
if(window.location.pathname=="/users/register"){
You're using =
instead of ==
.
In any case you should use CakePHP's functions to check for the controller/view combination instead of what you're doing now:
if( $this->params['controller'] == 'users' && $this->params['action'] == 'register' ) {
echo $this->Html->scriptBlock( "$('body).css('position', 'relative'); etc etc" );
}
精彩评论