zurück zur Startseite
  


Zurück XHTMLforum > Webentwicklung (außer XHTML und CSS) > Javascript & Ajax
Seite neu laden change "checked" to "clicked"?

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (permalink)  
Alt 11.10.2015, 10:32
qim qim ist offline
Neuer Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 24.03.2015
Beiträge: 21
qim befindet sich auf einem aufstrebenden Ast
Standard 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>
and changed to this

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>
The result is that the little triangle no longer changes direction as the visitor "ticks" the box, becuase there is no checkbox to be "ticked".
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='&#9650';
  
 }
else {
   amount0.value=amount1.value;
   amount1.value=(rates[cur1.value]*amount0.value/rates[cur0.value]).toFixed(2);
   document.getElementById('lab').innerHTML='&#9660';
   test=true;
  }
 }
Mit Zitat antworten
Sponsored Links
  #2 (permalink)  
Alt 12.10.2015, 10:35
Erfahrener Benutzer
XHTMLforum-Kenner
 
Registriert seit: 30.01.2014
Beiträge: 2.247
cloned ist ein wunderbarer Anblickcloned ist ein wunderbarer Anblickcloned ist ein wunderbarer Anblickcloned ist ein wunderbarer Anblickcloned ist ein wunderbarer Anblickcloned ist ein wunderbarer Anblickcloned ist ein wunderbarer Anblick
Standard

No there isn't such a thing. You need to rewrite your Javascript to make this work
Mit Zitat antworten
Sponsored Links
  #3 (permalink)  
Alt 12.10.2015, 10:39
qim qim ist offline
Neuer Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 24.03.2015
Beiträge: 21
qim befindet sich auf einem aufstrebenden Ast
Standard

Do you mean a couple of lines, or a big job?

I know virtually nothing of javascript...
Mit Zitat antworten
Antwort

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus


Ä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


Alle Zeitangaben in WEZ +2. Es ist jetzt 09:32 Uhr.