RobberBaron Posted March 4, 2010 Share Posted March 4, 2010 I have a search input box on my site that has the text 'Search Term' in the style 'font-style:italic; color:A4A4A4;'. When you click it, it's supposed to run a Javascript command that changes the style to normal and the font color to black. This doesn't work. The exact command: <input type="text" id="query" name="query" value="Search Term" onclick="java script:if (this.value='Search Term') { this.value=''; this.style='color:#000000;'; } this.style='color:#000000;';" style="color:#A4A4A4; font-style:italic;" onfocus="java script: if (this.value='Search Term') { this.value=''; } this.style=''; " /> It makes it blank when you click it, but the style remains. Can someone help? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 4, 2010 Share Posted March 4, 2010 The style property isn't a string, you would need to access the style properties individually, e.g.:this.style.color = '#000000'; Link to comment Share on other sites More sharing options...
RobberBaron Posted March 5, 2010 Author Share Posted March 5, 2010 The style property isn't a string, you would need to access the style properties individually, e.g.:this.style.color = '#000000';Aha! Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.