小编MrE*_*der的帖子

使用JavaScript更改IE中的<input>类型

以下代码适用于所有Web浏览器,除了IE:

<input type="text" name="passwordLogin" value="Password" onfocus="if(this.value=='Password'){this.value=''; this.type='password'};" onblur="if(this.value==''){this.value='Password'; this.type='text'};" size="25" />
Run Code Online (Sandbox Code Playgroud)

如何为IE修复它?

我做了一些更改,但仍然有错误.

我希望它像这样工作:

<input type="text" name="usernameLogin" value="Email" onfocus="if(this.value=='Email'){this.value=''};" onblur="if(this.value==''){this.value='Email'};" size="25" />
Run Code Online (Sandbox Code Playgroud)

如果我不输入任何东西,它会把价值放回去.

所以我尝试了这个:

<td colspan="2" id="passwordLoginTd">
     <input id="passwordLoginInput1" type="text" name="passwordLogin" value="Password" onfocus="passwordFocus()" size="25" />
     <input id="passwordLoginInput2" style="display: none;" type="password" name="passwordLogin" value="" onblur="passwordBlur()" size="25" />
    </td>
    <script type="text/javascript">
    //<![CDATA[

     passwordElement1 = document.getElementById('passwordLoginInput1');
     passwordElement2 = document.getElementById('passwordLoginInput2');

     function passwordFocus() {

      passwordElement1.style.display = "none";
      passwordElement2.style.display = "inline";
      passwordElement2.focus();

     }

     function passwordBlur() {

      if(passwordElement2.value=='') {

       passwordElement2.style.display = "none";
       passwordElement1.style.display = "inline";
       passwordElement1.focus(); …
Run Code Online (Sandbox Code Playgroud)

html javascript internet-explorer

9
推荐指数
2
解决办法
2万
查看次数

如何使用PHP将会话从一个页面继续到另一个页面

好的,我设置了一个会话......但是现在如何让它在我的其他页面上运行?

我试过了

@session_start();

if(isset($_SESSION['$userName'])) {

 echo "Your session is running " . $_SESSION['$userName'];

}
Run Code Online (Sandbox Code Playgroud)

php session

4
推荐指数
1
解决办法
7万
查看次数

PHP strlen问题

好的我正在检查一个字符串是否至少4个字符长,25个或更少的字符短

我试着像这样使用strlen

$userNameSignupLength = strlen($userNameSignup);

else if($userNameSignupLength<4 && $userNameSignupLength>25) {

            $userNameSignupError = "Must be between 4 to 25 characters long";

        }
Run Code Online (Sandbox Code Playgroud)

但它不起作用......我做错了什么?

php validation strlen

2
推荐指数
1
解决办法
2073
查看次数

网页在Firefox中看起来不错,但其他浏览器都讨厌它

我正在努力建立自己的网站,而且它很顺利.在打开并且工作得非常好的时候,Firefox看起来很漂亮.但后来我在任何其他浏览器中运行它并不起作用.我怎样才能解决这个问题?Interner Explorer特别讨厌它= [

你只需要知道我在说什么,所以这里是链接:

http://opentech.durhamcollege.ca/~intn2201/brittains/chatter/

请提供不涉及JavaScript的解决方案.

html css xhtml

0
推荐指数
1
解决办法
386
查看次数

标签 统计

html ×2

php ×2

css ×1

internet-explorer ×1

javascript ×1

session ×1

strlen ×1

validation ×1

xhtml ×1