Intos a écrit :
Hi.
How to change the text of inputbox if i have already set the style for
something else?
document.forms[0].elements['myInput'].value = 'some text';
In other words:
<input name="fItem" type="text" id="fItem" style="border:hidden" size="80"
maxlength="60" border="0" />
I can not add two styles on the same inputbox so i guess that javascript is
the only solution?
certainly not
If so, then how ?
Perhaps would you have to learn a bit about CSS ?
In JS :
var d = document.forms[0].elements['myInput'].style:
d.color = 'blue';
d.fontWeight = 'bold';
d.textDecoration = 'underline';
d.textAlign = 'center';
etc ... etc ...
try :
<html>
<style type="text/css">
..red { color: red }
..blu { color: blue }
..bold { font-weeight: bold; }
input { color: inherit; border: 3px solid green }
</style>
<form action="#" onsubmit="return false">
<p class="red" id="one">
<input value="test 1">
<input value="test 2 (blue n' bold by class)" class="blu bold">
<input value="test 1">
</p>
<p class="blu" id="two">
<input value="test 4">
<input value="test 5 (red n' bold by style)"
style="color:red;font-weight:bold"">
<input value="test 6">
</p>
<p><button onclick="var d =document.getElementById('one');
d.className = d.className=='red'? 'blu' : 'red';">toggle 1</button>
<button onclick="var d =document.getElementById('two');
d.className = d.className=='red'? 'blu' : 'red';">toggle 2</button>
</form>
</html>
--
sm