...

View Full Version : Styling with JS !!!??



liccy
09-10-2008, 07:50 PM
Hi all...

Can someone tell me what is wrong with my script... is no changing the text color :O/

<script type="text/javascript">

function init() {

if (!document.getElementById('txt').value = "Recipient's name").style.color = "#a3a3a3";

}

</script>


Thank

Philip M
09-10-2008, 08:50 PM
<input type ="text" size = "50" id = "txt" onblur = "init()">

<script type="text/javascript">
function init() {
if (document.getElementById('txt').value != "Recipient's name") {
document.getElementById("txt").style.color = "#a3a3a3";
}
}

</script>

Recipient's name is a literal string. OK?


Outside a secondhand shop: WE EXCHANGE ANYTHING - BICYCLES, WASHING MACHINES, ETC. WHY NOT BRING YOUR WIFE ALONG AND GET A WONDERFUL BARGAIN?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum