JavaScript
I've got this book on JavaScript(Wrox beginning JavaScript) it's good but...
I cant run my code, on the instructions (for windows) i edit in the text editor and open with Internet explorer, I tried that in mac and it doesnt work
Does anyone know how to run my JavaScript/HTML code on a mac??
----------------------------------------------------
Solution:
What you need to do, is while in textedit, go to the "Format" menu and choose "Make plain text", save it with the extension .html and open! ^^
thank u for all that helped!
I cant run my code, on the instructions (for windows) i edit in the text editor and open with Internet explorer, I tried that in mac and it doesnt work

Does anyone know how to run my JavaScript/HTML code on a mac??
----------------------------------------------------
Solution:
What you need to do, is while in textedit, go to the "Format" menu and choose "Make plain text", save it with the extension .html and open! ^^
thank u for all that helped!
What text editor are you using on the Mac?
First thing that comes to mind is that the line endings are incorrect. Another thing that comes to mind is that I wouldn't bother with Internet Explorer for anything since it sucks so bad -- especially on Windows, but also on the Mac. The last thing that comes to mind is, are you sure your Javascript is correct?
Or maybe he accidentally saved it as richtext…
I use the TextEdit application.
And by what i see on windows the internet explorer(which i also agree that it sucks) when opens a file with HTML, it reads the code and interprets it(including the JavaScript in the code), but it doesn't do that if in the options menu it's marked not to do, in that case it just opens the text file with the code on it(this is what happens in the mac too, with firefox and safari).
the problem isnt with the code or the format.
I just need to activate something to interpret the code(HTML/JS) and execute it, or maybe an app that also does that.
And by what i see on windows the internet explorer(which i also agree that it sucks) when opens a file with HTML, it reads the code and interprets it(including the JavaScript in the code), but it doesn't do that if in the options menu it's marked not to do, in that case it just opens the text file with the code on it(this is what happens in the mac too, with firefox and safari).
the problem isnt with the code or the format.
I just need to activate something to interpret the code(HTML/JS) and execute it, or maybe an app that also does that.
Textedit normally saves RTF
And if you are saving as HTML, it thinks what you typed is styled text
that is supposed to show up on the page.
Try changing fonts,sizes and colors and save as html..you'll see what I mean.
Check out Smultron and Editra for your coding text needs.
You'll be good to go.
You should not embed your javascript in the Html by the way.
Save as a .js file and use
in the body of your HTML code.
You should be able to test your .js files and scripts in the browser address bar.
Ex:
jalert("It works!")
file:///path/to/your/javascript.js
file:///path/to/your/webpage.html
And if you are saving as HTML, it thinks what you typed is styled text
that is supposed to show up on the page.
Try changing fonts,sizes and colors and save as html..you'll see what I mean.
Check out Smultron and Editra for your coding text needs.
You'll be good to go.
You should not embed your javascript in the Html by the way.
Save as a .js file and use
Code:
<script src="thescriptname.js" type="text/javascript">
//or
<script language="JavaScript" src="yourfile.js"></script>
in the body of your HTML code.
You should be able to test your .js files and scripts in the browser address bar.
Ex:
jalert("It works!")
file:///path/to/your/javascript.js
file:///path/to/your/webpage.html
What you need to do, is while in textedit, go to the "Format" menu and choose "Make plain text". That way, when you save it, it will be plain text. You can then change the extension to .html and open it with a web browser.
No that isn't the problem (i think). In the preference of the TextEdit it automatically changes the font when save to html. i will keep trying and edit here later
Edit:
Wohooooooo it worked!!!!
I have to convert it to plain text and save it to .HTML and just open it in safari!!!
later i will try i game3d's method, should work too. ohh yes and i did this simple code to test if it works:
ohh and one more question how do i make that box around my code???
Edit:
Wohooooooo it worked!!!!
I have to convert it to plain text and save it to .HTML and just open it in safari!!!
later i will try i game3d's method, should work too. ohh yes and i did this simple code to test if it works:
Code:
<html>
<head>
<title>Work!!!</title>
</head>
<body>
<script language="JavaScript">
document.write("Work!!");
</script>
</body>
</html>
Glad you got it to work!
Wise Druid Wrote:ohh and one more question how do i make that box around my code???On the message editing page, select the code you want to be in a code box and click on the # sign on the right, just above the editor. Or you can manually add the tags yourself.
Code:
//Thanks ;p
Yes now it works fine!! just need the TextEdit and safari!
Ohh and you can use JS to make dashboard widgets (using Xcode).
But i don't think there is an IDE for HTML/JS...
Wise Druid Wrote:But i don't think there is an IDE for HTML/JS...
Dreamweaver?
Or maybe OpenMocha?, which is free.
Wise Druid Wrote:No that isn't the problem (i think). In the preference of the TextEdit it automatically changes the font when save to html. i will keep trying and edit here later
Edit:
Wohooooooo it worked!!!!
I have to convert it to plain text and save it to .HTML and just open it in safari!!!
later i will try i game3d's method, should work too. ohh yes and i did this simple code to test if it works:
ohh and one more question how do i make that box around my code???Code:
<html>
<head>
<title>Work!!!</title>
</head>
<body>
<script language="JavaScript">
document.write("Work!!");
</script>
</body>
</html>
Glad it worked. I am currently trying TacoHTMLEdit which imho is pretty good. You would probably just want to try out all the suggestions and choose for yourself.
Wise Druid Wrote:But i don't think there is an IDE for HTML/JS...
Checkout Textmate-- or Coda if you want a little more structure. Both work grand for JS and HTML.
I used Taco HTML Edit, And it worked for me!
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Odd javascript bug | anthony | 2 | 5,758 |
Nov 28, 2010 08:29 AM Last Post: anthony |
|
JavaScript in Cocoa tutorial | willThimbleby | 4 | 6,738 |
Apr 27, 2006 05:12 PM Last Post: Skorche |
|
Help with text-based (Javascript) RPG | assylian | 3 | 6,380 |
Mar 18, 2006 03:18 PM Last Post: Justin Brimm |
|
Anyone wants to make a JavaScript file OOP? | Taxxodium | 1 | 4,086 |
Sep 23, 2005 02:28 AM Last Post: Taxxodium |