Javascript Tutorial

Anything technology related that does not fit in other categories
User avatar
Red Squirrel
Posts: 29193
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Javascript Tutorial

Post by Red Squirrel »

Allowing visitors to post content to your website is a great way to keep those visitors coming back and a great way to attract new visitors.bbCode is a simple way to give your visitors the ability to jazz up their plain text without leaving yourself open to the risks of html.

http://www.iceteks.com/articles.php/javascript/1

Archived topic from Iceteks, old topic ID:3247, old post ID:26403
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29193
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Javascript Tutorial

Post by Red Squirrel »

This section does not parse html, that, for example, would be disasterous if parsed. (text areas, tables, etc can be lethal for the layout)

Archived topic from Iceteks, old topic ID:3247, old post ID:26552
Honk if you love Jesus, text if you want to meet Him!
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

Well spotted guest . . . needless to say I put that in just to make sure you're all still awake. ;)

Archived topic from Iceteks, old topic ID:3247, old post ID:26558
Image
User avatar
Red Squirrel
Posts: 29193
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Javascript Tutorial

Post by Red Squirrel »

Not sure why the hits on this article are so low though, I did the mailing a few days ago. :o Maybe I should try slashdot.

Archived topic from Iceteks, old topic ID:3247, old post ID:26559
Honk if you love Jesus, text if you want to meet Him!
User avatar
rovingcowboy
Posts: 1505
Joined: Wed Dec 18, 2002 10:14 pm

Javascript Tutorial

Post by rovingcowboy »

:unsure: did not read the article red but since most places dont let you post to the
site servers on the free hosts javascript posting does not work. some places let you use a cgi folder for which you can use the posting that way. but not many.

:(

Archived topic from Iceteks, old topic ID:3247, old post ID:26564
roving cowboy/ keith
User avatar
Red Squirrel
Posts: 29193
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Javascript Tutorial

Post by Red Squirrel »

Yeah php only works on hosts that you pay for. Really, not sure why free ones don't allow php since it's not really all that hard to do. I guess it's a security issue.

Archived topic from Iceteks, old topic ID:3247, old post ID:26565
Honk if you love Jesus, text if you want to meet Him!
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

javascript is client side (although there is a server side - don't think i'll go there though) so that isn't a problem but a bbCode editor is fairly useless without running scripts on the server.

There are free hosts that allow you to use php (and MySQL). I used lycos tripod for a while before deciding to pay for a decent host.

Archived topic from Iceteks, old topic ID:3247, old post ID:26585
Image
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

Javascript Tutorial

Post by rip_phreaker »

hey, i would suggest getting the jsdk from sun java (version 1.4.2 i believe not 1.5) and getting either j-creator or eclipse...it is all open source and is some of the best java scripting software out there right now....with j-creator all u need is the sdk and the doc files no need for setting up your eutoexic.bat file for running programs and it is just an over-all great program i use it like almost everyday (when i am not using the mighty turing)

Archived topic from Iceteks, old topic ID:3247, old post ID:26714
User avatar
Red Squirrel
Posts: 29193
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Javascript Tutorial

Post by Red Squirrel »

I need to get into javascript, you can do neat stuff with that to make a site more interactive. We sort of "learned" it in our html class, but we did not really learn it. It was more like "copy this code here, and here's what it does". :lol:

Archived topic from Iceteks, old topic ID:3247, old post ID:26717
Honk if you love Jesus, text if you want to meet Him!
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

Javascript Tutorial

Post by rip_phreaker »

well if u want me too i will find the links and stuff for getting the programs that i described above? i will tell ya now java scripting is a pain in the a$$ i do not like it very much, but it is more versatile then turing and delphi and c and c++ and python and cobalt...lol what other lingo's do i use? i forget but ya java is great cus it is multi=platformed and will work on sooo many different os'es or else i would not touch it

Archived topic from Iceteks, old topic ID:3247, old post ID:26719
User avatar
Red Squirrel
Posts: 29193
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Javascript Tutorial

Post by Red Squirrel »

Oh are you talking about java or javascript? Get's confusing but java is different then javascript. Well I think they're the same it's just that java is for applications while JS is for client side web, but I think the syntax is the same. May be wrong though. If you want you can actually post that app in the download section. Not much in there so we need more stuff. :D

Archived topic from Iceteks, old topic ID:3247, old post ID:26721
Honk if you love Jesus, text if you want to meet Him!
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

Javascript Tutorial

Post by rip_phreaker »

well javascript is the name for java...they are the same thing really java scripting is just used by java programmers really... and the files are huge (the doc file is like 60 Mb) plus u really need to look on the sites for proper downloading types...also my schools programming site is AMAZING for learning the java....some great links and excersise there

Archived topic from Iceteks, old topic ID:3247, old post ID:26725
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

rip_phreaker wrote: well javascript is the name for java...they are the same thing really java scripting is just used by java programmers really... and the files are huge (the doc file is like 60 Mb) plus u really need to look on the sites for proper downloading types...also my schools programming site is AMAZING for learning the java....some great links and excersise there
Java is NOT the same as javascript. The fact they have a similar name is just some messed up marketing gimic. Javascript was originally put out by Netscape as LiveScript around the same time that Java was getting a lot of attention as 'the next big thing'. When Netscape then started supporting java applets they changed the name of LiveScript to JavaScript hoping some of the success of Java would rub off on their offering.

In summary, they're totally different.

Archived topic from Iceteks, old topic ID:3247, old post ID:26736
Image
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

Javascript Tutorial

Post by rip_phreaker »

actually BOB (the original form of java) was produced by netscape

javascripting is the name for coding and java is just the common name for running javascripting if u do not program it... java scripting is just the name for programming java

it was originally programmed for use in handheld devices (not palmpilots) but for the original lcd remotes, because it was versatile then they figured out that it was a much more dynamic way to get live animation over the web (at the time most websites where static and this was pre-flash and before .gif's where big)

if you would like i can post the link for the history of java

Archived topic from Iceteks, old topic ID:3247, old post ID:26743
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

Ok, script written in java could be called java script but that isn't the same as 'JavaScript'.

Java is a programming language, you can use it to produce complete programs. Javascript is a scripting language and so can only be used inside browsers.

To use javascript inside a website you include the code within SCRIPT tags, to use java via applets in a browser I believe you use applet of object tags.

Archived topic from Iceteks, old topic ID:3247, old post ID:26744
Image
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

Javascript Tutorial

Post by rip_phreaker »

ya javascripting would be like:

Code: Select all

import java.awt.*
-codes of the program

[code]


and then u must creat and html file to call the .class file of the java program u ust wrote




 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:3247, old post ID:26745[/size][/color]
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

I'll take your word for it as I've never used Java.

However a javascript file would be something like this:

Code: Select all

<html>
<head>
<title>Basic Hello, World Javascript file</title>
</head>
<body>
<script LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">

document.write("Hello, World!")

</SCRIPT>

</body>
</html>[code] 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:3247, old post ID:26746[/size][/color]
Image
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

Javascript Tutorial

Post by rip_phreaker »

since i am not too great with java i will do the basic form of applet i was taught

Code: Select all

import java.awt.*


public class applet
{
   public static void main (String[] args) 
   {
      System.out.println ("Hello World")
   }
   
}
[code] this program would then be compiled
then you would need an html file with like 
[code]
[html]
[import java class = applet.class]  % not too sure about this coding
[/html]
[code]

not too sure about the html but then you would just open the .html file and it would show "Hello World" in the window

so basically how i was taught was free running java programs and applet java are both the same coding and so forth i am not too great with html tho 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:3247, old post ID:26747[/size][/color]
Anonymous

Javascript Tutorial

Post by Anonymous »

The opening tag and closing tag are both supplied as variables to the function and all that happens is they are both tacked onto the end of the users post. In some bbcode editors (certainly phpBB and probably others) highlighting text and then using this function will wrap the highlighted text in the appropriate bbcode tags. This editor doesn't have this functionality. If this is something you feel your users will need it should be possible to reconstruct this functionality by looking at the source html for an editor that allows this.
These articles are great! Thanks a million for taking time to write them up.

There are two problems with the method you've presented, as I'm sure you're aware. One is that if you want to add bold (as an example) to text that isn't at the end of what has been typed in, you're out of luck. Some might not figure out that they have to type in the code manually. The other is that many users will try to highlight the text and then click the bold button (because they've learned to do that in word processors). So I think we need a little more functionality, especially if it's not too hard to do.


When I looked at phpBB's bbcode, it looked like they had to create workarounds for the javascript capabilities of different browsers. In particular it seemed like they needed alternatives for the arrayname.length, arrayname.pop(), and arrayname.push(value) properties.

I'm wondering if it's possible to work around those problems? Is it even a problem if you're using 6th generation browsers?


Do you have any thoughts on how to go about solving the problem?

Thanks, Jonathon!

Archived topic from Iceteks, old topic ID:3247, old post ID:27819
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

Hi art,

I'm glad you liked the article. You're absolutely right in that some functionality is missing though, not applying bbcode to highlighted text and not autocompleting tags on submission are the two major issues in my opinion. They'll both throw a lot of new users.

To be honest though I haven't looked in detail at either issue though I do remember phpBB used a workaround from reading through the code when I wrote the article. I would like to think that this is just a segment of code from an earlier version (why fix it if it isn't broken?) that still works but isn't needed with more modern browsers. Changing the user agent to IE breaks the functionality in firefox but thats to be expected using IE specific code. I'm not sure how to change the user agent in IE and don't really have the time at the moment to mess around with the code.

If you do have the time to play around and report back though that would be great.

Archived topic from Iceteks, old topic ID:3247, old post ID:27827
Image
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Javascript Tutorial

Post by Streety »

Well it should definitely work so I'm not sure what the problem is. Can you post a link to the files you are working on so I can take a look?

Archived topic from Iceteks, old topic ID:3247, old post ID:28315
Image
Anonymous

Javascript Tutorial

Post by Anonymous »

now i'm just trying to solve everything about 3 things:

1. js compatibility in firefox
2. html and css (later css) compatibility with xhtml and css standards
3. Codes' shortcut keys, like the ones here and with phpBB, but should be accordant to the function that is accomplished (i'm talking about the part where i edited to solve art's problem)

again, can someone please help before i finish it myself, lol :evilsmile:

Archived topic from Iceteks, old topic ID:3247, old post ID:32786
User avatar
rovingcowboy
Posts: 1505
Joined: Wed Dec 18, 2002 10:14 pm

Javascript Tutorial

Post by rovingcowboy »

this whole javascript and java codeing error's thing can be fixed by any none coding moron including my self which am a huge non coding moron.

what you need to do is go get the new eversoft firstpage 2006 program they updated their old 1st page 2000 html text editor

it still has all the help for all the web page coding script languages you can find the program at snapfiles.com or at download.com which ever you want to use. it might also be at majorgeeks.com by now?
:awesome:

Archived topic from Iceteks, old topic ID:3247, old post ID:34235
roving cowboy/ keith
Anonymous

Javascript Tutorial

Post by Anonymous »

Hi,

Is this thread still active?

The code seems to work fine once you tidy up the html on the first page.

Im after a basic editor with bold, underline, italics and link.

With the functionality that it adds the tags to the selected words as it does in this forum when posting to a topic.

Could the code here be easily alterd to have that function?


Thanks

Archived topic from Iceteks, old topic ID:3247, old post ID:36132
wtd
Posts: 157
Joined: Sat Sep 25, 2004 7:21 pm

Javascript Tutorial

Post by wtd »

Any particular reason this:

Code: Select all

eval("window.document.editform."+name+".value = newbut;");[code]

Cannot be:

[code]window.document.editform[name].value = newbut;[code]

And why:

[code]var post = window.document.editform.post.value;
window.document.editform.post.value = post + tagclose;[code]

Cannot be simplified to:

[code]var post = window.document.editform.post;
post.value += tagclose;[code] 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:3247, old post ID:36142[/size][/color]
Locked