|
|||
change "checked" to "clicked"?
Entschuldigung für das Schreiben aus Englisch
I have some HTML code like this Code:
<div> <label id="lab" for="swop" title="click to reverse rate">▼</label> <input id="swop" type="checkbox"> </div><div> <input type="text" id="amount1" value=""> </div> Code:
<div> <label id="lab" for="swop" title="click to reverse rate">▼</label> <input id="swop" type="text" value="Reverse rate"> </div> <div> <input type="text" id="amount1" value=""> </div> Instead, there is a box with text that gets "clicked" I have no knowledge of javascript but assume that there must be some code that can substitute "if(swop.checked==true)" to something that will mean "if(swop.clicked==true) ". Could you help me sort out those lines please' Code:
cur0.onchange=function() { if(swop.checked==true) { amount1.value=amount0.value; amount0.value=(rates[cur0.value]*amount1.value/rates[cur1.value]).toFixed(2); } else { amount1.value=(rates[cur1.value]*amount0.value/rates[cur0.value]).toFixed(2); } } cur1.onchange=function() { if(swop.checked==true) { amount1.value=amount0.value; amount0.value=(rates[cur0.value]*amount1.value/rates[cur1.value]).toFixed(2); } else { amount1.value=(rates[cur1.value]*amount0.value/rates[cur0.value]).toFixed(2); } } amount0.onkeyup=function() { amount0.value=this.value; amount1.value=(rates[cur1.value]*amount0.value/rates[cur0.value]).toFixed(2); } amount1.onkeyup=function() { amount1.value=this.value; amount0.value=(rates[cur0.value]*amount1.value/rates[cur1.value]).toFixed(2); } swop.onclick=function() { if(this.checked==true) { amount1.value=amount0.value; amount0.value=(rates[cur0.value]*amount1.value/rates[cur1.value]).toFixed(2); document.getElementById('lab').innerHTML='▲'; } else { amount0.value=amount1.value; amount1.value=(rates[cur1.value]*amount0.value/rates[cur0.value]).toFixed(2); document.getElementById('lab').innerHTML='▼'; test=true; } } |
Sponsored Links |
Themen-Optionen | |
Ansicht | |
|
|
Ähnliche Themen | ||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
change Table bg.color wenn div.hover | erich.wanker | CSS | 2 | 13.03.2014 14:03 |
Symlink ändern, change symbolic link target | dr_colossos | Serveradministration und serverseitige Scripte | 3 | 18.03.2013 11:39 |
Image Change ? | meGa | Javascript & Ajax | 10 | 20.02.2007 15:00 |
background change | meGa | Javascript & Ajax | 3 | 28.12.2006 19:51 |
IE zeigt falsch, FF richtig - change - FF zeigts falsch, IE richtig | nick | CSS | 6 | 19.08.2006 03:02 |