Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Posts
    682
    Thanks
    319
    Thanked 1 Time in 1 Post

    FF but not IE, typical.

    Yeah, as usual IE sucks.

    JavaScript:
    Code:
    function background_text(obj, fun) {
    	//Get the id of clicked field
    	var id = obj.id.split("input_"); id = id[1] + "_bg";
    	
    	switch (fun) {
    		//Remove the content from the background div
    		case "remove":
    			document.getElementById(id).innerHTML = '';
    		break;
    		
    		//Add the content back into the div
    		case "add":
    			if (obj.value.length == 0) {
    				document.getElementById(id).innerHTML = document.getElementById(obj.id).getAttribute('btext');
    			}
    		break;
    	}
    }
    HTML:
    Code:
    <?php 
    //Get variable from request to send back correct form
    $form = $_GET['form'];
    switch($form) {
    	case "login":
    ?>
    <form name="login" class="login">
    	<label for="username">Username: </label><br />
    	<div id="username_container">
    		<div class="input_field" id="username_bg">Username</div>
    		<input type="text" name="username" id="input_username" onclick="background_text(this, 'remove')" onblur="background_text(this, 'add')"
            btext="Username..."/>
    	</div>
    	<br />
    	<label for="password">Password: </label><br />
    	<div id="password_container">
       		<div class="input_field" id="password_bg">Password</div>
    		<input type="password" name="password" id="input_password" onclick="background_text(this, 'remove')" onblur="background_text(this, 'add')"
            btext="Password..."/>
        </div>
        <br />
        <label for="remember">Remember Me? </label><br />
        <span class="remember">
        	<span class="text">Never</span>
        	<input type="hidden" value="never" name="rememberme" />
       		<ul>
        		<li>Never</li>
        		<li>24 Hours</li>
        		<li>1 Week</li>
        		<li>Always</li>
        	</ul>
    	</span>
    </span>
    <?php break; case "register": ?>
    <form name="register" class="login">
    	<label for="username">Username: </label><br />
    	<div id="username_container">
    		<div class="input_field" id="username_bg">Choose a username...</div>
    		<input type="text" name="username" id="input_username" onclick="background_text(this, 'remove')" onblur="background_text(this, 'add')" 			
            btext="Choose your username..."/>
    	</div>
    	<br />
    	<label for="password">Password: </label><br />
    	<div id="password_container">
    		<div class="input_field" id="password_bg">Choose a password...</div>
    		<input type="password" name="password" id="input_password" onclick="background_text(this, 'remove')" onblur="background_text(this, 'add')"
            btext="Choose your password..." />
    	</div>
    <?php break; case "recovery":
    break;
    
    }
    ?>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,550
    Thanks
    78
    Thanked 4,382 Times in 4,347 Posts
    ??? Worked the same for me in FF 3.6 and MSIE 7.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Posts
    682
    Thanks
    319
    Thanked 1 Time in 1 Post
    Why do my browsers seem to hate me today I will post more information tomorrow, sleep time

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,017
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    Quote Originally Posted by martynball View Post
    Yeah, as usual IE sucks.
    Ever heard about the bad workman who blames his tools?

  • #5
    Regular Coder
    Join Date
    Nov 2007
    Posts
    682
    Thanks
    319
    Thanked 1 Time in 1 Post
    Everything I code though works in FF but not always IE, always have to tweek the code or add more for it. I hate IE. I hate M$ for that matter.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •