这是我的 PHP 代码的一部分,其中有一个回显,它将打印一些 HTML 代码,带有onblur
andonfocus
条件。此代码在其外部echo
但不在其内部时有效。
我已经尝试input
在我的代码(Username
字段)中的第一个添加双引号,但它仍然不起作用......有什么
想法吗?!
elseif ($_GET['register'] == "true"){ echo "
<div class='index_register'>
Register to Play or <a href='login.php'>login</a>
<p></p>
<!-- Registration Form -->
<form action='?do=register' method='post' autocomplete='off'>
<input class=\"input_reg\" type=\"text\" name=\"username\" size=\"40\" maxlength=\"12\" value=\"Username\" onblur=\"if (this.value == \"\") {this.value = \"Username\";}\" onfocus=\"if (this.value == \"Username\") {this.value = \"\";}\">
<input class='input_reg' type='text' name='email' size='40' maxlength='50' value='Email Address' onblur='if (this.value == '') {this.value = 'Email Address';}' onfocus='if (this.value == 'Email Address') {this.value = '';}'>
<input class='input_reg' type='password' name='password' size='40' maxlength='12' value='Password' onblur='if (this.value == '') {this.value = 'Password';}' onfocus='if (this.value == 'Password') {this.value = '';}'>
<input class='submit' type='submit' value='Register' name='Register'>
</form>
</div>
"; }