AJAX Forums

is there any MOD Command in JavaScript?

This is a discussion on is there any MOD Command in JavaScript? within the JavaScript forums, part of the Beginners AJAX category; Hi ! I use the MOD (gets the rest of a division) in VBScript.Now.. i need to use it in JS . Do you know how ?Something like:var rest = 10 ...


Go Back   AJAX Forums > Beginners AJAX > JavaScript

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Old 05-31-2007, 05:24 PM   #1 (permalink)
Junior Member
 
Join Date: May 2007
Posts: 1
Rep Power: 0 Murch is on a distinguished road
is there any MOD Command in JavaScript?

Hi ! I use the MOD (gets the rest of a division) in VBScript.Now.. i need to use it in JS. Do you know how ?Something like:var rest = 10 mod 3thanks a lot!Marcelo.Paul J thanks for the very good answer..I will set you as the best answer.But.. i found an easyer way.. using a native command of JS :The % operator.Something like:var rest = 10 % 3Thanks!
__________________
Murch is offline   Reply With Quote
Old 06-01-2007, 03:45 AM   #2 (permalink)
Junior Member
 
Join Date: Jun 2007
Posts: 1
Rep Power: 0 Paul J is on a distinguished road
Here is the way to do itfunction Mod(X, Y) { return X - Math.floor(X / Y) * Y;}function checkMod(){intAns = Mod(10, 3);alert (intAns)}
__________________
Paul J is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Ajax getData command failing in IE..? woolyg AJAX Questions 0 04-20-2008 07:50 PM
What is the best css command to hide login date for myspace? CyberCrawl XHTML and CSS 1 03-28-2007 11:14 AM
Take Command with AJAX : Build WebConsole Application using Ajax Ajaxking AJAX Articles 0 12-17-2006 10:12 PM


All times are GMT -4. The time now is 08:43 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5
Copyright ©2006 - 2008, AJAXwith.com