Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 6, 2013, 10:49 AM   #1
dinggus
Banned
 
Join Date: Jan 2012
How to run a javascript

How can I run a javascript just from my computer? I'd like to test a script out.
dinggus is offline   0 Reply With Quote
Old Feb 6, 2013, 10:57 AM   #2
imaketouchtheme
macrumors 65816
 
imaketouchtheme's Avatar
 
Join Date: Dec 2007
Location: WV
Send a message via Skype™ to imaketouchtheme
Quote:
Originally Posted by dinggus View Post
How can I run a javascript just from my computer? I'd like to test a script out.
Google Chrome? View > Developer > Javascript Console
__________________
imaketouchtheme is offline   0 Reply With Quote
Old Feb 6, 2013, 11:01 AM   #3
dinggus
Thread Starter
Banned
 
Join Date: Jan 2012
Quote:
Originally Posted by imaketouchtheme View Post
Google Chrome? View > Developer > Javascript Console
Thanks, do I just enter the script info or what? Can I PM you the script code?

Last edited by dinggus; Feb 6, 2013 at 11:06 AM.
dinggus is offline   0 Reply With Quote
Old Feb 7, 2013, 04:33 AM   #4
Dunmail
macrumors regular
 
Join Date: Mar 2009
Location: Skipton, UK
Quote:
Originally Posted by dinggus View Post
Thanks, do I just enter the script info or what? Can I PM you the script code?
Simply create a web page and include the code. Save the file locally and double click it to open in your browser. If your script relies on certain elements being on the page then you'll have to add them.

Code:
<!DOCTYPE html>
<html>
<head>
<!-- put CSS links and meta tags here -->
</head>
<body>
<!-- Any elements you need for your script to work -->
<script src = "path to your script"></script>
</body>
</html>
Depending on how you've written your script you may have to add an event handler to the body:

Code:
<body onload="entryfunction()">
Better is to use the IIFE (Immediately Invoked Function Expression) format at the foot of the page:

Code:
<script>
(function (){
// All your code here or call your entry function.
}());
</script>
Dunmail is offline   0 Reply With Quote
Old Feb 7, 2013, 07:23 AM   #5
960design
macrumors 6502a
 
Join Date: Apr 2012
Location: Destin, FL
Or your could use something like:

http://writecodeonline.com/javascript/
__________________
TI-99/4A, tape cassette, 12" B&W Zenith
960design is offline   0 Reply With Quote
Old Feb 7, 2013, 07:26 AM   #6
MyNameIsDave
macrumors member
 
Join Date: May 2012
Location: Blighty
If your code depends on other libraries such as jQuery, you can try it out online at jsfiddle.net

You can then share it with other people if you want to show them about your code (e.g. to get help with it).
MyNameIsDave is offline   0 Reply With Quote
Old Feb 12, 2013, 10:15 PM   #7
dinggus
Thread Starter
Banned
 
Join Date: Jan 2012
Quote:
Originally Posted by MyNameIsDave View Post
If your code depends on other libraries such as jQuery, you can try it out online at jsfiddle.net

You can then share it with other people if you want to show them about your code (e.g. to get help with it).
Thanks I shared it with Dunmail and his response was:
Quote:
look at that code looks like it is a subsystem that gets called from something else. It relies on jquery so you'd need that. Not sure what else it might need.

Either ask whoever you got the script from or create a web page with buttons that when clicked call the functions in the code.
So, now I'm stuck because I how no clue how who to get ahold of for the script, or create a web page with buttons to call the functions.
dinggus is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Trying to run run 2x OS X Mavericks and one install of Win 7 on my MBP Manuelrodrigues OS X Mavericks (10.9) 8 Apr 22, 2014 07:51 PM
Creating the iOS game Run Crab Run SambaPanda iPhone and iPod touch Apps 2 Jul 14, 2013 10:42 PM
[Game] Run Tappy Run (by Tapps) - Universal App fwatanabe iPhone and iPod touch Apps 0 Jul 16, 2012 03:22 PM

Forum Jump

All times are GMT -5. The time now is 04:32 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC