Javascript 使用php echo的语法错误输入字段Html

Javascript 使用php echo的语法错误输入字段Html,javascript,php,html,Javascript,Php,Html,我希望通过phpecho显示此输入,但在以下php语句中从输入中删除readonly属性时: <? echo '<input class="form-control" name="cant-'.$indice.'+'.($t+1).'" id="cant-'.$indice.'+'.($t+1).'" value="'.$cant_guardada.'" readonly="true" ondblclick="this.readOnly='';" onblur="this.r

我希望通过php
echo
显示此输入,但在以下php语句中从输入中删除readonly属性时:

    <?
echo '<input class="form-control" name="cant-'.$indice.'+'.($t+1).'" id="cant-'.$indice.'+'.($t+1).'" value="'.$cant_guardada.'" readonly="true" ondblclick="this.readOnly='';" onblur="this.readOnly='true';">';
 ?>

它扔了这个: 错误:语法错误,意外的“”;“onblur=“this.readOnly=”(T_常量_封装的_字符串),应为“,”或“;”

我知道这是一个报价相关的错误,但我似乎找不到它,有人能帮我吗


<?php echo '<input class="form-control" name="cant-'.$indice.'+'.($t+1).'" id="cant-'.$indice.'+'.($t+1).'" value="'.$cant_guardada.'" readonly="true" ondblclick="this.readOnly=\'\';">';  ?>

this.readOnly=''
处的单引号需要转义

至少显示引发错误的代码段,而不是有效的代码段。在带有双倒逗号的PHP Echo语句之间,永远不要使用双倒逗号。。。永远不要。(特别是当你要写带有属性的前端代码时)编辑!抱歉,从添加了onblur的同一行复制了错误。