我正在尝试将onfocus / onblur事件添加到表单中,但不知怎的,我没有让它工作。我认为它与逃避报价有关,但我尝试了几种方法却没有成功。我的代码是这样的:
echo '<input type="password" id="'.$field->name.'" name="'.$field->name.'" size="30" class="inputbox" placeholder="'.$field->title.'"
onfocus="this.placeholder = ''" onblur="this.placeholder = '.$field->title.'"
/>'."\n";
break;
答案 0 :(得分:1)
你的onblur字符串周围缺少引号:
<?php
echo '<input type="password" id="' . $field->name . '" name="' . $field->name . '" size="30" class="inputbox" placeholder="' . $field->title . '" onfocus="this.placeholder = ''" onblur="this.placeholder = \'' . $field->title . '\'" />'."\n";