Jump to content


Photo

Return To Default Values


  • Please log in to reply
2 replies to this topic

#1 aksun

aksun

    New member

  • New Members
  • 5 posts
  • LocationOulu, Finland

Posted 10 May 2013 - 01:52 PM

Hello, i have this code:
<tr>
		<td><br /><input type="text" size="30" name="voittaja" /></td>
		<td id="vaihda"><br />Voittajapelaajan nimi.<br /></td>

		
</tr>
<tr>
		<td><br /><input type="text" size="30" name="haviaja" /></td>
		<td id="vaihda2"><br />Häviäjäpelaajan nimi.<br /></td>

		
</tr>
<tr>
		<td><br /><input type="checkbox" id="valittu" /><br /></td>
		<td><br />Tasapeli?<br /></td>
</tr>
<tr>
		<td><br /><input type="text" id="voittajap" size="5" /></td>
		<td><br />Voittajapelaajan eräpisteet.</td>
</tr>
<tr>
		<td><br /><input type="text" id="haviajap" size="5" /></td>
		<td><br />Häviäjäpelaajan eräpisteet.</td>
		</tr>
		<script type="text/javascript">
document.getElementById('valittu').onchange = function() {
        document.getElementById('voittajap').disabled = this.checked;
	document.getElementById('haviajap').disabled = this.checked;
	document.getElementById('voittajap').value = "1.5";
	document.getElementById('haviajap').value = "1.5";
	document.getElementById('vaihda').innerHTML = "<br />Pelaajan nimi";
	document.getElementById('vaihda2').innerHTML = "<br />Pelaajan nimi";
}
</script>
Well, i'm trying to change input values and some tds, when clicking the checkbox. It works fine, but there is my problem:
when unchecking the checkbox, it don't return back to "default" values. :bash: How can i make this work like that? PS: the code might include errors or something(i'm not very good at js).
  • 0

#2 aksun

aksun

    New member

  • New Members
  • 5 posts
  • LocationOulu, Finland

Posted 11 May 2013 - 06:55 AM

Well thank you for nothing, i solve problem by myself. ^_^
  • 0

#3 Stefan

Stefan

    Stefan Mischook

  • Administrators
  • 4,321 posts
  • LocationMontreal Canada

Posted 11 May 2013 - 07:16 AM

Well, now that you figured it out yourself, you will never forget the answer!

:clap:

Stef
  • 0
StudioWeb makes teaching web design and programming easy: StudioWeb




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

★★★★★ 5 Star Rated Web Developer Course - check it out now!