Your thoughts on jQuery?
Page 1 of 1
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Sun, 19th Sep 2010 19:53    Post subject: Your thoughts on jQuery?
www.jquery.com

I simply love it Smile

A friend of mine send me a simple C# calculator he programmed. It had a display field and buttons and the + operator.

So I tried developing a html/js calculator. I built a basic webpage with the display field and the buttons and started writing the javascript code to get calculator functionality via buttons working.

Code:
a='value';function v(x){return $('#d').attr(a,x)}$('.b').click(function(){(n = $(this).attr(a))!='='?v(v()+n):v(eval(v()))})


126Bytes Smile It's ugly yes but it's quite short!

Here is the whole sourcecode for the working calculator
 Spoiler:
 


PS:
I know that you could create the buttons with js code too but that was not the point:)
And that you can have it even shorter...

short_calc_by_pumpy.html wrote:
<script>
alert(eval(prompt()));
</script>



But that doesn't have the buttons Sad


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
chiv




Posts: 27530
Location: Behind You...
PostPosted: Sun, 19th Sep 2010 20:02    Post subject:
sounds like queery hahahahahaahahaah


Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group