Click here to Skip to main content
15,868,141 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Iframe Alternative ? Pin
jderonde8-Apr-10 5:04
jderonde8-Apr-10 5:04 
QuestionCSS Translucent Background Pin
SRJ923-Nov-09 10:40
SRJ923-Nov-09 10:40 
AnswerRe: CSS Translucent Background Pin
greendragons3-Nov-09 10:59
greendragons3-Nov-09 10:59 
GeneralRe: CSS Translucent Background Pin
SRJ923-Nov-09 11:01
SRJ923-Nov-09 11:01 
GeneralRe: CSS Translucent Background Pin
greendragons3-Nov-09 11:03
greendragons3-Nov-09 11:03 
GeneralRe: CSS Translucent Background Pin
SRJ923-Nov-09 11:05
SRJ923-Nov-09 11:05 
GeneralRe: CSS Translucent Background Pin
Oakman3-Nov-09 11:51
Oakman3-Nov-09 11:51 
QuestionDefault TextBox Text..... Pin
greendragons3-Nov-09 7:03
greendragons3-Nov-09 7:03 
Hello,
I am trying to make a textbox with default text..as user clicks it should disappear.I succeeded in doing that but got struck while differing the classes of default text and user input...
here is my code
............................................................................................................
<html>
<head>
      <style>
       
          .hint{color:blue;}
          .real{color:black;}
         
      </style>
     <script type="text/javascript">
          window.onload = onchange;
          function foc(){
               if(this.value.length==0 || this.className=="hint"){
                    this.value="";
                    this.className=="real";
               }
              
          }
          function blur(){
               if(this.value.length==0){
                   
                    this.className = "hint";
                    this.value="Enter";
               }
              
          }
          function onchange(){
               var text = document.getElementById("textbox1");
                        
                    text.onfocus = foc;
                    text.onblur = blur;
         
            }         
     </script>
</head>
<body>
        <input type="text" id="textbox1" class="hint" value="Enter"/>
</body>
</html>    
..........................................................................................................

The problem is in function foc(), i want that if onfocus event rises then class of the textbox should change to real...but that's not happening and creating all trouble.
I want that the hint text should appear in blue and input in black. Also if user purposely enters the hint text as input then script should judge on classes not on text values. Like here hint text or default text is Enter....even if user input is Enter then that text should not disappear onblur...
THNX.
AnswerRe: Default TextBox Text..... Pin
Not Active3-Nov-09 8:53
mentorNot Active3-Nov-09 8:53 
GeneralRe: Default TextBox Text..... Pin
greendragons3-Nov-09 10:18
greendragons3-Nov-09 10:18 
GeneralRe: Default TextBox Text..... Pin
Not Active3-Nov-09 10:47
mentorNot Active3-Nov-09 10:47 
GeneralRe: Default TextBox Text..... Pin
greendragons3-Nov-09 10:54
greendragons3-Nov-09 10:54 
GeneralRe: Default TextBox Text..... Pin
Oakman3-Nov-09 12:03
Oakman3-Nov-09 12:03 
GeneralRe: Default TextBox Text..... Pin
greendragons3-Nov-09 12:08
greendragons3-Nov-09 12:08 
GeneralRe: Default TextBox Text..... Pin
Not Active3-Nov-09 12:27
mentorNot Active3-Nov-09 12:27 
GeneralRe: Default TextBox Text..... Pin
Oakman3-Nov-09 13:26
Oakman3-Nov-09 13:26 
GeneralRe: Default TextBox Text..... Pin
greendragons3-Nov-09 12:11
greendragons3-Nov-09 12:11 
GeneralRe: Default TextBox Text..... Pin
Oakman3-Nov-09 14:58
Oakman3-Nov-09 14:58 
GeneralRe: Default TextBox Text..... Pin
Not Active3-Nov-09 12:29
mentorNot Active3-Nov-09 12:29 
GeneralRe: Default TextBox Text..... Pin
Oakman3-Nov-09 13:26
Oakman3-Nov-09 13:26 
AnswerRe: Default TextBox Text..... Pin
Aman Bhullar3-Nov-09 21:32
Aman Bhullar3-Nov-09 21:32 
GeneralRe: Default TextBox Text..... Pin
greendragons4-Nov-09 0:57
greendragons4-Nov-09 0:57 
Questionhow to develop blog websites in joomla Pin
Amit Spadez3-Nov-09 2:31
professionalAmit Spadez3-Nov-09 2:31 
AnswerRe: how to develop blog websites in joomla Pin
Richard MacCutchan3-Nov-09 2:50
mveRichard MacCutchan3-Nov-09 2:50 
AnswerRe: how to develop blog websites in joomla Pin
Abhishek Sur3-Nov-09 4:51
professionalAbhishek Sur3-Nov-09 4:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.