Javascript power!
Javascript power!
Βασικά είμαι άσχετος(ξερω τα πολύ βασικά που έχουν σχέση με χειρισμούς παραθύρων) από javascript αλλα βλέπω ότι έχεις πολλές ομοιότητες με τζαβα. Αυτό που θέλω να μάθω είναι τι δυνατότητες έχει. Πχ θέλω φτιάξω ένα hashtable αυτό θα είναι αποδοτικό ή θα σερνεται. Γενικά θέλω να μάθω τι εκτελεί από πίσω η javascript native κώδικα. Σε πολλές περιπτώσει μου θυμίζει και λίγο C
H δύναμη της εξαπάτησης και της καταστροφής μπορεί να γοητεύσει μόνο μέτριους και αδύναμους
Τhe lessons we learn from pain are the ones that make us the strongest
Τhe lessons we learn from pain are the ones that make us the strongest
H javascript χρησιμοποιείται κυρίως σε web εφαρμογές για να δώσει περισσότερες δυνατότητες αλληλεπίδρασης στην ιστοσελίδα και να την κάνει γενικά πιο φιλική στο χρήστη. Δεν χρησιμοποιείται για την ανάπτυξη μεγάλων εφαρμογών.
Το καλύτερο που έχεις να κάνεις για αρχή είναι να διαβάσεις κανένα tutorial.
http://www.webteacher.com/javascript/
http://www.w3schools.com/js/js_intro.asp
http://www.echoecho.com/javascript.htm
(Να ένα πολύ καλό θέμα για το Wiki)
Το καλύτερο που έχεις να κάνεις για αρχή είναι να διαβάσεις κανένα tutorial.
http://www.webteacher.com/javascript/
http://www.w3schools.com/js/js_intro.asp
http://www.echoecho.com/javascript.htm
(Να ένα πολύ καλό θέμα για το Wiki)

- HdkiLLeR
- Venus Project Founder
- Posts: 4356
- Joined: Tue Jan 27, 2004 4:41 pm
- Academic status: Alumnus/a
- Gender: ♂
- Location: New York, NY
- Contact:
Re: Javascript power!
Επίσης έχε υπόψην σου ότι τα implementation δεν είναι standardized. Κοινώς ο κάθε browser υλοποιεί όπως θέλει απο κάτω την JS, με αποτέλεσμα ο ίδιος code να έχει σημαντική χρονική διαφορά ανάλογα τον browser που τρέχει. Βέβαια για απλές micro εφαρμογές όπως αυτές που χρησιμοποιείς embedded μέσα σε μια dynamic HTML σελίδα δεν υπάρχει ουσιαστική διαφορά αλλά εάν κάνεις ένα stretch / benchmark θα το δεις.adam98 wrote:Βασικά είμαι άσχετος(ξερω τα πολύ βασικά που έχουν σχέση με χειρισμούς παραθύρων) από javascript αλλα βλέπω ότι έχεις πολλές ομοιότητες με τζαβα. Αυτό που θέλω να μάθω είναι τι δυνατότητες έχει. Πχ θέλω φτιάξω ένα hashtable αυτό θα είναι αποδοτικό ή θα σερνεται. Γενικά θέλω να μάθω τι εκτελεί από πίσω η javascript native κώδικα. Σε πολλές περιπτώσει μου θυμίζει και λίγο C
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d-->--- s+:+ a- C++(+++) BILS++++$ P--- L++++>+++++ E--- W+++ N+ o+ K w--
O M+ V-- PS++>+++ PE- Y++ PGP++ t+ 5+ X+ R* tv b++ DI- D+ G+++ e+++>++++ h r++ y++
------END GEEK CODE BLOCK------
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity." -- Dennis Ritchie
Version: 3.12
GCS d-->--- s+:+ a- C++(+++) BILS++++$ P--- L++++>+++++ E--- W+++ N+ o+ K w--
O M+ V-- PS++>+++ PE- Y++ PGP++ t+ 5+ X+ R* tv b++ DI- D+ G+++ e+++>++++ h r++ y++
------END GEEK CODE BLOCK------
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity." -- Dennis Ritchie
Αυτό που με ενδιαφερει είναι τι κωδικας εκτελείται απο πισω δηλαδή μια εντολη javascript ειναι wrapper για native κωδικα. Ευχαριστω και πάλι όποιον βοήθησε με post
H δύναμη της εξαπάτησης και της καταστροφής μπορεί να γοητεύσει μόνο μέτριους και αδύναμους
Τhe lessons we learn from pain are the ones that make us the strongest
Τhe lessons we learn from pain are the ones that make us the strongest
- lumenintervalum
- Wow! Terabyte level
- Posts: 2377
- Joined: Thu May 06, 2004 7:06 pm
- Location: somewhere far beyond..
- Contact:
Επίσης,
http://www.javascript.com/
http://javascript.internet.com/ ίσως σου φανούν χρήσιμα αργότερα
Επίσης, δες και στο w3 τις σελίδες που αναφέρονται σε DOM
http://www.javascript.com/
http://javascript.internet.com/ ίσως σου φανούν χρήσιμα αργότερα
Επίσης, δες και στο w3 τις σελίδες που αναφέρονται σε DOM
We are just a moment in time
A blink of an eye
A dream for the blind
Visions from a dying brain
I hope you don't understand
_______________________
scraps& photo gallery στο deviantart- last update 25/08/06
A blink of an eye
A dream for the blind
Visions from a dying brain
I hope you don't understand
_______________________
scraps& photo gallery στο deviantart- last update 25/08/06
- lumenintervalum
- Wow! Terabyte level
- Posts: 2377
- Joined: Thu May 06, 2004 7:06 pm
- Location: somewhere far beyond..
- Contact:
ίσως χρειαστεί σε κάποιον το παρακάτω
πηγή: http://www.javascriptkit.com/javatutors/navigator.shtmlUsing the navigator object to detect client's browser
Until one browser remains standing on the web (if ever), browser detection will continue to be part of any good JavaScripter's life. Whether you're gliding a div across the screen or creating an image rollover, it's fundamental that only relevant browsers pick up on your code. In this tutorial we'll probe the navigator object of JavaScript, and show how to use it to perform browser detection, whether the subject is Firefox, Internet Explorer 6, or even Opera 8.
The navigator object
The navigator object was conceived back in the days when Netscape Navigator reined supreme. These days it serves as much as an irony of NS's diminished market share as way of probing browser information.
The navigator object of JavaScript contains the following core properties:
Properties Description
appCodeName The code name of the browser.
appName The name of the browser (ie: Microsoft Internet Explorer).
appVersion Version information for the browser (ie: 4.75 [en] (Win98; U)).
cookieEnabled Boolean that indicates whether the browser has cookies enabled. IE4 and NS6+.
language Returns the default language of the browser version (ie: en-US). NS4 and NS6+ only.
mimeTypes[] An array of all MIME types supported by the client. NS4 and NS6+ only. Array is always empty in IE.
platform[] The platform of the client's computer (ie: Win32).
plugins An array of all plug-ins currently installed on the client. NS4 and NS6+ only. Array is always empty in IE.
systemLanguage IE4+ property that returns the default language of the operating system. Similar to NS's language property.
userAgent String passed by browser as user-agent header. (ie: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1))
userLanguage IE4+ property that returns the preferred language setting of the user. Similar to NS's language property.
Let's see exactly what these properties reveal of your browser:
AppCodeName: Mozilla
AppName: Netscape
AppVersion: 5.0 (Windows; en-GB)
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Platform: Win32
At a glance
You probably think you have a very solid idea now of how to utilize the navigator object to detect your client's browser type. At its most basic form, the following two properties are used:
navigator.appName
navigator.appVersion
For example:
//detect Netscape 4.7+
if (navigator.appName=="Netscape"&&parseFloat(navigator.appVersion)>=4.7)
alert("You are using Netscape 4.7+")
However, depending on the browser you're trying to detect, you'll find the above two properties too limiting.
Detecting Firefox 1.0+
Take for example, Firefox 1.0+. It shares the same "appName" value as older Netscape browsers, which is "Netscape." The appVersion value returned is also out of wack, which is "5." So we need to look to another property, which turns out to be "UserAgent." For Firefox 1.04 for example, its userAgent property reads:
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Ah ha, the text at the end of the string apparently contains the information we want. Based on this new found discovery, the below code detects if you're using Firefox 1.0+:
if(navigator.userAgent.indexOf("Firefox")!=-1){
var versionindex=navigator.userAgent.indexOf("Firefox")+8
if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
alert("You are using Firefox 1.x or above")
}
The code assumes that all Firefox versions contain the string "Firefox/" immediately followed by the version number (ie "1").
Detecting IE 5.5+
Detecting IE using the navigator object also poses a similar problem as Firefox, since its "navigator.appVersion" property contains more than just the version number of IE:
4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)
If we were to use parseFloat to try and extract out the browser version in "navigator.appVersion", we'd get 4.0, instead of the correct number (5.5). This is due to the way parseFloat works- by returning the first number it encounters. So, how does one go about getting the version number in IE? As with Firefox, it really comes down to how you wish to approach the issue. Lets stick with using the "navigator.appVersion" property this time, though you can certainly use "navigator.userAgent" as well:
//Detect IE5.5+
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
}
if (version>=5.5) //NON IE browser will return 0
alert("You're using IE5.5+")
In the above, string.split() is first used to divvy up navigator.appVersion into two parts, using "MSIE" as the separator:
4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)
As a result temp[1] contains the part after "MSIE", with the browser version appearing first. Doing a parseFloat() on temp[1] therefore retrieves the browser version of IE.
The Opera pitfall
Using the navigator object to screen for Opera is even a little more complex, as Opera by default identifies itself as IE, with Opera 8 identifying itself as IE6, inside "navigator.userAgent." The rationale for this is so that scripts screening for IE would also allow Opera through, so that Opera will render these pages properly. Lets take a look at what the userAgent of Opera 8.5 returns depending on what it is set to identify as:
As IE6: Mozilla/4.0 (compatible; MSIE 6.0; Windows XP) Opera 8.5 [en]
As Moz5: Mozilla/5.0 (Windows XP; U) Opera 8.5 [en]
As Opera: Opera/8.5 (Windows XP; U) [en]
"What's the problem? Opera 8.5 appears in each case." you may say. Well, look closer, and notice how when Opera is set to identify as itself, the Opera string returned is slightly different ("Opera/8.5" versus "Opera 8.5"). So ironically enough, the expression
if (navigator.userAgent.indexOf("Opera 8.5")!=-1)
will fail if the user has their browser set to identify as Opera, but not if any other browser!
Despite this oddity, the code to detecting Opera need not be any different than the one used to detect Firefox:
if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if (parseInt(navigator.userAgent.charAt(versionindex))>=8)
alert("You are using Opera 8 or 9")
}
This also assumes that all Opera versions contain the string "Opera" immediately followed by either a space or "/", then the version number (ie "8"). And since it only looks at the first number within the version, it can only detect up to Opera 9, not 10 for example.
Conclusion
We've seen how to use navigator to detect the browser type of your visitors. If the potential pitfalls and complexity of usage of it is a little too much for you, an alternative is to use Object Detection. Whichever method you choose, just be sure to choose one!
We are just a moment in time
A blink of an eye
A dream for the blind
Visions from a dying brain
I hope you don't understand
_______________________
scraps& photo gallery στο deviantart- last update 25/08/06
A blink of an eye
A dream for the blind
Visions from a dying brain
I hope you don't understand
_______________________
scraps& photo gallery στο deviantart- last update 25/08/06
- Fairy
- Gbyte level
- Posts: 1733
- Joined: Tue Jan 24, 2006 4:48 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: Mairyland Park

Όταν καλεί κάποιος τη μέθοδο alert ή την promt (πάντα για JavaScript μιλώ), υπάρχει δυνατότητα αλλαγής του τίτλου στο μικρό παραθυράκι που εμφανίζεται; Σημ: Έχει τη μορφή: [Εφαρμογή JavaScript] ή κάτι τέτοιο ανάλογα με τον browser.
"Αν αυτό που έκανες χτες σου φαίνεται ακόμα μεγάλο, δεν έχεις κάνει αρκετά σήμερα."
- Serendipity
- Gbyte level
- Posts: 1977
- Joined: Tue Sep 19, 2006 11:16 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: Sweden
- Contact:
Re: Javascript power!
γεια σας!και καλοριζικη η καινουρια μορφη του φορουμ μας.λοιπον,σε 1 πρωτη αποπειρα να αρχισω να ασχολουμαι πιο σοβαρα με το web developing/designing βρηκα κατι ωραιες διαφανειες για javascript εδω και τις παραθετω αμα ενδιαφερεται καποιος.
-Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.
--Albert Einstein--


My new blog Serendipity's thoughts!
--Albert Einstein--


My new blog Serendipity's thoughts!
- Michelle
- Gbyte level
- Posts: 1168
- Joined: Sun Jul 15, 2007 8:05 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: MIT
- Contact:
Re:
Όχι, δεν γίνεται δυστυχώς.Fairy wrote:Έχω μια ερώτηση προγραμματιστικής φύσεως:
Όταν καλεί κάποιος τη μέθοδο alert ή την promt (πάντα για JavaScript μιλώ), υπάρχει δυνατότητα αλλαγής του τίτλου στο μικρό παραθυράκι που εμφανίζεται; Σημ: Έχει τη μορφή: [Εφαρμογή JavaScript] ή κάτι τέτοιο ανάλογα με τον browser.
Question everything (and first of all, yourself)
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
- Zifnab
- Venus Former Team Member
- Posts: 7581
- Joined: Tue Nov 15, 2005 2:42 am
- Academic status: MSc
- Gender: ♂
- Location: Connecticut
- Contact:
Re: Javascript power!
Μπορείς να το κάνεις μέσω VBScript, δεν ξέρω αν σε βολεύει...
http://www.webdeveloper.com/forum/showt ... hp?t=30118
http://www.webdeveloper.com/forum/showt ... hp?t=30118
- Michelle
- Gbyte level
- Posts: 1168
- Joined: Sun Jul 15, 2007 8:05 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: MIT
- Contact:
Re: Javascript power!
Έτσι όμως θα δουλεύει μόνο σε ΙΕ!!Zifnab wrote:Μπορείς να το κάνεις μέσω VBScript, δεν ξέρω αν σε βολεύει...
http://www.webdeveloper.com/forum/showt ... hp?t=30118


Question everything (and first of all, yourself)
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
- proskopos
- Wow! Terabyte level
- Posts: 2808
- Joined: Tue Dec 18, 2007 4:01 pm
- Academic status: Alumnus/a
- Gender: ♂
- Location: Στα φεγγάρια του Πλάνταρ...
- Contact:
Re: Javascript power!
Θέλω να βρώ ένα javascript (ή κάτι άλλο...), ώστε όταν ανοίγει ο χρήστης μια σελίδα, να εμφανίζεται απο μπροστά του ένα παράθυρο με ένα κείμενο που θέλω εγώ... Ξέρει κανείς ένα τέτοιο....;
- ~~Wind~~
- Gbyte level
- Posts: 1747
- Joined: Thu Nov 30, 2006 1:07 am
- Academic status: N>4
- Gender: ♂
- Location: *void
Re: Javascript power!


Come to foss-aueb ...we have cookies.. yamyam~nomnomnomnomnomnomnomnom
a cookie ~ I will do science to it
- Michelle
- Gbyte level
- Posts: 1168
- Joined: Sun Jul 15, 2007 8:05 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: MIT
- Contact:
Re: Javascript power!
Τι είδους παράθυρο;proskopos wrote:Θέλω να βρώ ένα javascript (ή κάτι άλλο...), ώστε όταν ανοίγει ο χρήστης μια σελίδα, να εμφανίζεται απο μπροστά του ένα παράθυρο με ένα κείμενο που θέλω εγώ... Ξέρει κανείς ένα τέτοιο....;
Αν το περιγράψεις λίγο καλύτερα αυτό που εννοείς θα μπορέσουμε να σε βοηθήσουμε αποδοτικότερα.

ΥΓ: Πάντως οποιαδήποτε από τις πιθανές επιλογές και να εννοείς, έχε υπόψιν ότι ενοχλεί τους χρήστες όταν ανοίγουν τη σελίδα να εμφανίζεται και ένα popup, ειδικά αν το θεωρούν περιττό.
Question everything (and first of all, yourself)
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
- Michelle
- Gbyte level
- Posts: 1168
- Joined: Sun Jul 15, 2007 8:05 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: MIT
- Contact:
Re: Javascript power!
Μπορεί να μην εννοεί alert...~~Wind~~ wrote:![]()
ενα πολυ απλοCode: Select all
<script type="text/javascript">alert("Τσουπ! Ενα παράθυρο!")</script>
Question everything (and first of all, yourself)
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
- proskopos
- Wow! Terabyte level
- Posts: 2808
- Joined: Tue Dec 18, 2007 4:01 pm
- Academic status: Alumnus/a
- Gender: ♂
- Location: Στα φεγγάρια του Πλάνταρ...
- Contact:
Re: Javascript power!
Xmmm θα είναι ένα παράθυρο που θα τους ενημερώνει ότι πρέπει να ενεργοποιήσουν το active x....Michelle wrote:Τι είδους παράθυρο;proskopos wrote:Θέλω να βρώ ένα javascript (ή κάτι άλλο...), ώστε όταν ανοίγει ο χρήστης μια σελίδα, να εμφανίζεται απο μπροστά του ένα παράθυρο με ένα κείμενο που θέλω εγώ... Ξέρει κανείς ένα τέτοιο....;
Αν το περιγράψεις λίγο καλύτερα αυτό που εννοείς θα μπορέσουμε να σε βοηθήσουμε αποδοτικότερα.
ΥΓ: Πάντως οποιαδήποτε από τις πιθανές επιλογές και να εννοείς, έχε υπόψιν ότι ενοχλεί τους χρήστες όταν ανοίγουν τη σελίδα να εμφανίζεται και ένα popup, ειδικά αν το θεωρούν περιττό.
- Michelle
- Gbyte level
- Posts: 1168
- Joined: Sun Jul 15, 2007 8:05 pm
- Academic status: Alumnus/a
- Gender: ♀
- Location: MIT
- Contact:
Re: Javascript power!
Δεν εννοούσα αυτό, αλλά αν κρίνω από αυτό που θες, σε καλύπτει μια χαρά η λύση που πρότεινε ο Wind.proskopos wrote:Xmmm θα είναι ένα παράθυρο που θα τους ενημερώνει ότι πρέπει να ενεργοποιήσουν το active x....Michelle wrote:Τι είδους παράθυρο;proskopos wrote:Θέλω να βρώ ένα javascript (ή κάτι άλλο...), ώστε όταν ανοίγει ο χρήστης μια σελίδα, να εμφανίζεται απο μπροστά του ένα παράθυρο με ένα κείμενο που θέλω εγώ... Ξέρει κανείς ένα τέτοιο....;
Αν το περιγράψεις λίγο καλύτερα αυτό που εννοείς θα μπορέσουμε να σε βοηθήσουμε αποδοτικότερα.
ΥΓ: Πάντως οποιαδήποτε από τις πιθανές επιλογές και να εννοείς, έχε υπόψιν ότι ενοχλεί τους χρήστες όταν ανοίγουν τη σελίδα να εμφανίζεται και ένα popup, ειδικά αν το θεωρούν περιττό.

Question everything (and first of all, yourself)
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
w3.org/People/all#lea ✿ lea.verou.me ✿ @leaverou on Twitter
- djsolid
- Kilobyte level
- Posts: 483
- Joined: Thu Dec 02, 2004 7:36 pm
- Academic status: Alumnus/a
- Gender: ♂
- Location: Πετράλωνα
- Contact:
Re: Javascript power!
Λοιπόν αφού έχεις σκαλώσει και θέλεις να βάλεις ActiveX μέσα στην σελίδα σου
τότε η καλύτερη λύση για να ενημερώσεις τον χρήστη περιλαμβάνεται μεσα στο αρχειάκι που επισυνάπτω
.
Αλλά μια συμβουλή. ΜΗΝ βάλεις ActiveX. Κατα τη γνώμη μου δεν υπάρχει λόγος. But it's your call.


Αλλά μια συμβουλή. ΜΗΝ βάλεις ActiveX. Κατα τη γνώμη μου δεν υπάρχει λόγος. But it's your call.
You do not have the required permissions to view the files attached to this post.
Last edited by djsolid on Fri Jul 18, 2008 8:21 pm, edited 1 time in total.
- proskopos
- Wow! Terabyte level
- Posts: 2808
- Joined: Tue Dec 18, 2007 4:01 pm
- Academic status: Alumnus/a
- Gender: ♂
- Location: Στα φεγγάρια του Πλάνταρ...
- Contact:
Re: Javascript power!
Ωραία να μην το βάλω... Αλλά πως θα το κάνω αυτό...? Το slideshow που έχω το καλεί απο μόνο του...! Έχεις εσύ κάποιο άλλο ωραίο slideshow χωρίς active x?...djsolid wrote:Λοιπόν αφού έχεις σκαλώσει και θέλεις να βάλεις ActiveX μέσα στην σελίδα σου τότε η καλύτερη λύση για να ενημερώσεις τον χρήστη περιλαμβάνεται μεσα στο αρχειάκι που επισυνάπτω.
Αλλά μια συμβουλή. ΜΗΝ βάλεις ActiveX. Κατα τη γνώμη μου δεν υπάρχει λόγος. But it's your call.