如果语句正确,如何使用javascript?

时间:2016-07-16 04:04:23

标签: javascript php html

所以我有这个程序,只要expiration datetoday的日期完全相同,<div>的背景就会改变它的颜色。但是现在,背景颜色仅在我的条件为==时才会发生变化,当我尝试使用>=<=时背景颜色不会改变。即使expiration date的背景颜色变化也与date today

不同

这是我的javascript:

<script type="text/javascript">

var $today = date("m/d/Y");
var $expired = $passport_expiration;

function myDIV() {
  if ($today == $expired) {
    document.getElementById("myDiv").style.backgroundColor="#ff4d4d";
  }
}
</script>

这是我的HTML:

<div class="col-md-6" id="myDiv">
    <div class="alert" role="alert"><span class="glyphicon glyphicon-book" aria-hidden="true"></span>&nbsp;&nbsp;Passport <?php echo "<strong><a href=\"view_latest_passport.php?id=$id\"> $passport</a> /&nbsp; Passport Expiration Date:</strong> $passport_expiration"; ?></div>
</div>

我如何获得$todaypassport_expiration,它位于query

提前谢谢

1 个答案:

答案 0 :(得分:0)

unset GIT_DIR
cd ..
git merge master

你需要在输入字段中分配那些值,然后才能在javascript中验证

<div class="col-md-6" id="myDiv">
    <div class="alert" role="alert">
    <span class="glyphicon glyphicon-book" aria-hidden="true"></span>&nbsp;&nbsp;
    Passport <?php echo "<strong><a href=\"view_latest_passport.php?id=$id\"> $passport</a> /&nbsp; 
    Passport Expiration Date:</strong> $passport_expiration"; ?></div>
    <input type="hidden" id="passport_expire_date" name="passport_expire_date" value="<?php echo $passport_expiration; ?>">
     <?php $date = date("m/d/Y "); ?>
     <input type="hidden" id="today_date" name="today_date" value="<?php echo $date; ?>">
</div>