Default TextBox Text.....
-
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"); &n
greendragons wrote:
want that the hint text should appear in blue and input in black.
Not possible in the same textbox at the same time Basically you seem very confused as to how CSS and JavaScript actually work
I know the language. I've read a book. - _Madmatt
-
greendragons wrote:
want that the hint text should appear in blue and input in black.
Not possible in the same textbox at the same time Basically you seem very confused as to how CSS and JavaScript actually work
I know the language. I've read a book. - _Madmatt
Then how this feature i have seen on many sites....there must be some way to create it...any ideas...
-
Then how this feature i have seen on many sites....there must be some way to create it...any ideas...
Just because you've seen something done doesn't mean it was done the way you think it was. What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML. With Flash or Silverlight it is.
I know the language. I've read a book. - _Madmatt
-
Just because you've seen something done doesn't mean it was done the way you think it was. What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML. With Flash or Silverlight it is.
I know the language. I've read a book. - _Madmatt
thnx for help...
-
Just because you've seen something done doesn't mean it was done the way you think it was. What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML. With Flash or Silverlight it is.
I know the language. I've read a book. - _Madmatt
Mark Nischalke wrote:
What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML.
Set the background of the text box to transparent. Line it up directly over a label (maybe in a user control) Format the text of the textbox one way and the text on the label another. A kluge, but it'd meet the design parameters as written.
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
-
Mark Nischalke wrote:
What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML.
Set the background of the text box to transparent. Line it up directly over a label (maybe in a user control) Format the text of the textbox one way and the text on the label another. A kluge, but it'd meet the design parameters as written.
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
If u don't mind please write the code... Thnx.
-
Mark Nischalke wrote:
What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML.
Set the background of the text box to transparent. Line it up directly over a label (maybe in a user control) Format the text of the textbox one way and the text on the label another. A kluge, but it'd meet the design parameters as written.
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
Ohhhhh i got it...sry i was little confused...Thnx..thtz quite tricky and defenitely will work...
-
If u don't mind please write the code... Thnx.
Hell, no!!!:mad::mad: Don't ask anyone else to do your work :mad::mad:
I know the language. I've read a book. - _Madmatt
-
Mark Nischalke wrote:
What you are asking for, applying two styles to the same textbox for two seperate pieces of text is not possible with HTML.
Set the background of the text box to transparent. Line it up directly over a label (maybe in a user control) Format the text of the textbox one way and the text on the label another. A kluge, but it'd meet the design parameters as written.
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
Oakman wrote:
A kluge,
To say the least :-D
I know the language. I've read a book. - _Madmatt
-
If u don't mind please write the code... Thnx.
greendragons wrote:
If u don't mind please write the code...
I don't mind at all. As long as you don't mind depositing $100.00 in my bank account. I am a professional. I write code for money.
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
-
Oakman wrote:
A kluge,
To say the least :-D
I know the language. I've read a book. - _Madmatt
Kluge-R-Us
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
-
Ohhhhh i got it...sry i was little confused...Thnx..thtz quite tricky and defenitely will work...
the answer to the question you delighted is "z-index"
Jon
Rob Graham wrote:
100% subsidies are very popular among the 50% of the population that pays no income tax...
-
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"); &n
Use
<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=""; document.getElementById('textbox1').className = 'real'; //this.className=="real"; } } function blur(){ if(this.value.length==0){ document.getElementById('textbox1').className = 'hint'; //this.className = ""; 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>Regards Aman Bhullar www.arlivesupport.com[^]
-
Use
<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=""; document.getElementById('textbox1').className = 'real'; //this.className=="real"; } } function blur(){ if(this.value.length==0){ document.getElementById('textbox1').className = 'hint'; //this.className = ""; 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>Regards Aman Bhullar www.arlivesupport.com[^]
Thtz great working and exactly i wanted to do...:) But please can you explain how class changed....i was using this.className...... and u used document.getElementById("textbox1").className=...... Apparently both are same since the value of this is document.getElementById("textbox1")..... but in this way it's working.....how????