Jump to content

Changing Displayed Text


Selacius

Recommended Posts

Try this

<html><head><script>function increment(targetId){  var targetElement = document.getElementById(targetId);  if(isNaN(targetElement))  {     alert('Can't increment. Value is not a number!');  }  else  {     targetElement.innerHTML = parseInt(targetElement.innerHTML) + 1;  }}</script></head><body><div id="counter">5</div><div><a href="javascript:void(0)" onclick="increment('counter')">Click Me</a></div></body>

Hope this works for you...let me know if it doesn't.

Link to comment
Share on other sites

Hmm...try this then?

<script type="text/javascript">function goThing(who) {x=document.getElementById(who).value;if(isNaN(x)){alert("Not a number, can not continue.")return;}eval("x+1")}</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...