View Single Post
Old 04-25-2009, 05:41 PM   #18 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Kalle View Post
Thats because checkbox_count is a function, and if you pass a function as a variable (a closure, I think Salathe covered this in a post of his) then it will print the closure's source. so I think what You want is to use:

javascript Code:
document.write(checkbox_count());

Assuming that checkboxes_count() ofcourse returns a numeric value for use here.


Instead of using document.write, you can always do a:
HTML Code:
<p>Times clicked: <span id="count">0</span></p>
<input type="button" onclick="++document.getElementById('count').innerHTML;" value="Bingo!" />
And have a <span> or <div> with an id/name given and then update the value which avoids embedding these <script> tags and then makes the code much cleaner and easier to work with.
Yes thanks! You're right, using Div or Span will help clean up the code I'll do that...

Here's what I'll do...

I want to finish this project up in straight up JS code. Then when it's done, I will jump on Mootools!!!

I'll try my best to finish it up today!
allworknoplay is offline  
Reply With Quote