1

i want to show div only Sunday Monday,Tuesday,Wednesday,Thursday

and hide it in ,Friday,Saturday

this my code:

<script>
function newep(){
var fecha = new date();
var day = fecha.getDay();
if(day == 4 || day == 5){
 console.log("show nothing");
}else if(day == 6 || day == 3){
 console.log("New Episodde");
}
}
</script>
<div onload="newep()">here the output</div>

1 Answer 1

0

I got that out of your code:

<script>
function newep(node)
{
var fecha = new date();
var day = fecha.getDay();
if(day == 4 || day == 5){
 node.hidden=true;
 //or : node.disabled=true
}
}
</script>

```<div onload="newep(this)">here the output</div>```

with php you could do:

<?php
$date_number=date('w');
if($date_number==5 || $date_number==6)
{
 ?>
 //your div
 <?php
}
?>
Sign up to request clarification or add additional context in comments.

4 Comments

wen i use the php version i get error ----> Parse error: syntax error, unexpected token "if" in
forgot the ; after $date_number=date('w') my bad
i need exacly like this can you tel me were is the error: <?php $date_number=date('w'); if($date_number==0 || $date_number==4) { ?> <span class="types types-new">Nuevo</span> <?php } ?> <?php else($date_number==5 || $date_number==6){?> <span class="types types-new">caducado</span> <?php } ?>
you forgot an if just after else there <?php $date_number = date('w'); if ($date_number == 0 || $date_number == 4) { ?> <span class="types types-new">Nuevo</span> <?php } else if($date_number == 5 || $date_number == 6) { ?> <span class="types types-new">caducado</span> <?php } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.