lundi 2 mars 2015

JavaScript if statement / displaying a button


I am trying to workout the following JavaScript if statement:



<script> if ($crs_date2 != '0000-00-00'){
document.write('No other course date available');


}else {
document.write(<button class='btn btn-danger data-toggle='modal' id='actionButtonOrange'>$crs_date2</button>);

}

</script>


, but I am encountering two issues:


1) The button is not being displayed.


2) the function does not seem to be working as intended.


Essentially what would happen is that if no date is available (by default it displays 0000-00-00 if no date is available but it is not aesthetically pleasing), the JavaScript message appears.


Thanks in advance





Aucun commentaire:

Enregistrer un commentaire