ECMAScript Syntax

Jul 20, 2005

Does the "semicolon insertion" really affect you if you format code as

function x (y)
{
// ...
}

instead of:

function x (y) {
// ...
}

The jslint page complains about lines ending in ) due to the nebulous
idea of "semicolon insertion". I have not reviewed the ECMAScript pdf
in great detail to try to pin this pretty-printing issue down. In
general, I find that code formatted in the "K&R" style (opening brace
on same line as if, while, function) confusing and difficult to read
compared with placing curly braces on separate lines.

On another subject, the difference between inner functions defined
explicitly versus defined using function expressions seems like a good
one for a FAQ. Under what circumstances does it make a real
difference whether you use function expression versus function
statement versus Function object?

View 1 Replies


ADVERTISEMENT

What Does The Future Hold For ECMAScript?

Apr 5, 2007

The ECMAScript Technical Committee is now working on the fourth
edition, the first implementation of which is JScript.NET. It
includes a compiler, allowing you to create standalone JScript
executables.

The fourth edition of ECMAScript will provide new features like
typed variables, and classes. More information can be found at:

View 3 Replies View Related

Script And ECMAScript / Relationship Between Them?

Oct 7, 2009

Can any explain the relationship between JavaScript and ECMAScript?

View 4 Replies View Related

Javascript, Ecmascript And DOM = Confusion

Jun 27, 2005

I noticed the recent move to standards compliant JavaScripting. All my code (XHTML and CSS) is coded to standards, so I don't want to start learning outdated material that wont sit right on with web standards.

What is the difference between JavaScript, ECMAScript and the DOM ?

I found a cheap JavaScript book at a bookstore (in the bargain bin) that looked quite good despite the low price. Will I most likely be learning invalid techniques if I use this book as a starting point?

I feel lost with all these different terms that seemingly mean the same thing: JavaScript.

I want to learn it, but I don't want to waste my time either. What is the best way to learn standards compliant JavaScript? Can I continue with what I have already (I have the JavaScript bible and another book I forget the title at this time) then slightly alter my knowledge to be standards compliant, or is it a whole new ball game?

View 5 Replies View Related

Question About Some Basic Functions In SVG ECMAScript

Jun 14, 2006

Sorry I couldn't find appropriate group for
SVG and ECMAScript. Since SVG is in XML format
and ECMAScript is very similar to JavaScript.
What's why I post in these two groups.

In the O'Reilly SVG book, in chapter 11
Animating and Scripting SVG. It mentions
some very basic functions like

var circle = event.getTarget();

var obj = svgDocument.getElementById("idName");

I got error message said these are no a function
in Firefox and batik-squiggle.jar

When I used SVGView plug-in (made by Adobe) for IE .

I typed:

var svgObject = evt.target;
var svgDoc = svgObject.getOwnerDocument();
var svgElement = svgDoc.getElementById(idName);
var svgStyle = svgElement.getStyle();
svgStyle.setProperty('stroke-width', 3);

These lines are working fine for SVGViwe Plug-in by
not work for Firefox and batik.
They complained that getOwnerDocument is not a function.
I tried to change getSVGDocument but no luck.

Is that O'Reilly book too old? Its first editoin is 2002.

How can I make getElementById() working in Firefox and Batik?
Is there some examles or some documents?

View 1 Replies View Related

ECMAScript Interpreter Stack Overflow?

Aug 23, 2006

I'm testing out the Opera browser to see what to expect from the upcomming Wii browser. But whenever I try to play this javascript game (www.kirl.nl/javaSnake.html), I get the following error:

"ECMAScript interpreter stack overflow.
Script terminated."

How does Opera handle Javascript diffrently, is there possibly a site wich lists the diffrences between the browsers and how they handle code?

Any specific Opera quirks you know of?

View 3 Replies View Related

Start Learning ECMAScript 5 - ES3 And Then Learn ES5?

May 19, 2010

I am a begginer in JavaScript,

Do I start learning(today) ECMAScript 5 or ES3 and then learn ES5?

View 2 Replies View Related

Getters And Setters For Object Properties In JS 1.5 And ECMAScript

Jul 23, 2005

In JavaScript 1.5, objects can use special getter and setter functions
[1] for properties. However, these only seem to be implemented in Gecko
and, AFAICT, don't seem to be part of ECMAScript.

Is there an alternative syntax I can use that is standardised in
ECMAScript and also (preferably) interoperably implemented in several
browsers? Or, do I have to use ordinary getFoo() and setFoo() functions. Code:

View 2 Replies View Related

JQuery :: Syntax Error,uncaught Exception: Syntax Error, Unrecognized Expression: [@href^="mailto:"]

Jun 6, 2010

i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:

i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]

View 5 Replies View Related

Syntax

Jul 20, 2005

I am trying to order a laptop from the Dell online shop but
everytime I try to press 'continue' after picking the options, I get
an error message in the lower left hand corner of the browser.
I'm using WIN 98SE with java enabled on my laptop.

The error log says:
Line: 1
Char: 1
error: object expected
code: 0

And this is the line which pops up when I place the cursor on the
'continue' button causing the above error:

javascript:next_page(Ƈ','c=us&cs=19&kc=6V602&l=en&oc=5100FS&s=dhs');

I would assume there's a bug in that line. Although there's little I
can do about it other than forward it to the Dell folks - my pgming
background has me curious as to what's causing this!

View 8 Replies View Related

Is This Syntax Correct?

Jul 23, 2005

onClick="javascript:myFunction()"

or does it HAVE to be

onClick:"myFunction()"

I know 'javascript' is not necessary here, but just want to know whether to include it (which sometimes I do by mistake) is incorrect syntax or not..

View 1 Replies View Related

Syntax Error

Aug 12, 2005

I have this JavaScript that is supposed to show random products from my
database, and show something different every time you refresh or revisit.
But I keep getting an error - on my computer - that says Syntax Error in
Line 2.

There is no error on most other computers, and the products show, but
another script on the page, an article title scroller, stops - on most
computers, but not all. It says "no articles available".

I've tried the script on an asp page and a htm page, all by itself, but it
still doesn't work. I tried changing all kinds of settings in my browsers,
but nothing helps. I'm on XP, SP2, which I've heard has some problems
handling javascripts. I don't know if that's true, but if it is, I know that
lots of other people will have the same problem as me when they view the
page. Actually, I think it is a good thing, that my computer is pointing out
this error. I get the error message in IE6, but in NS8 and FF, I just don't
see the products. No error message.

Anyway, here are the first three lines of the script:

<%
if TRIM(request.servervariables("http_referer")) = "" then
%>

Using spellcheck, I found that referer is spelled wrong, it should be
referrer. I don't know if that is right for javascript (or asp?), but
correcting it didn't make a difference.

The script is JavaScript on an asp page, and it is called in an htm page.

Is the error obvious from the 3 lines?

View 8 Replies View Related

Alert Syntax

Sep 12, 2005

How does one center text in an alert box? and how do you make the alert box
appear in the middle of the screen? I've seen it done, but my alerts have
text left justified, and the box is longer than i need.

View 1 Replies View Related

Syntax -0 At End Of Replace()

Nov 13, 2006

I found this in one of my old scripts but I can't remember what the -0 was used for. I remember it was a shortcut method but I can't remember for what. Does this ring a bell with anyone?

var Pattern = /px/;
var T = paddingArry[0].replace(Pattern, "")-0;

View 5 Replies View Related

Using Var Syntax Problem

Jul 20, 2005

Here is the code:

function fnSelectOption(fieldname)
{
document.mainform. + fieldname + .value = "value";
}

It obvliously bombs where I am trying to ref the param "fieldname". I
realize it is a simple syntax issue but I cannot seem to figure it out.

View 10 Replies View Related

JQuery :: Syntax For$() For A Different Doc?

Oct 27, 2010

I have a text string that is a complete html doc. How do I tell jquery to parse that?

Variable theDoc holds the other html doc.

I tried:

var doc = $(theDoc);

If it is "this" doc it looks like: var x = $('table:contains('test')).html(); I tried: var x = doc.find('table:contains('resume')).html();

It keeps saying something is null.

So what is the syntax to look inside another doc , not the one the code is currently in?

View 2 Replies View Related

Syntax To Hid Div Tag Other Than IE Browser

Aug 10, 2010

What is the syntax for hiding div tag for safari, firefox, chrome.In my webpage i've 2 div tag, based on the condition i'll show any one at a time.Can any one give a syntax to hide div in all kind of browser.

View 1 Replies View Related

What Would The Correct Syntax Be For This

Apr 7, 2011

What would the correct syntax be for this:

if('#loaded_max' == 3) {
loading = false;
}

View 3 Replies View Related

Document.write Syntax....

Jul 23, 2005

Recently writing some code i cross over a problem using document.write:

View 2 Replies View Related

Substring Syntax In Javascript

Jul 23, 2005

Trying to debug someone else's javascript code. There is a line that

looks like this:

req = req.substring(req.length-2, req.length);

From what I can gather in their comments, they want to capture the last two characters of the string "req".

I'm guessing that the above line won't do that, and they want to change it to

req = req.substring(req.length-1, 2);

In other words, the parameters are starting position, and length. Is that correct?

View 6 Replies View Related

Javascript Class Syntax

Apr 3, 2006

I discovered this syntax on the google example of a client to their web
service.

function PagClass()
{
this.init();
}

PagClass.prototype = {

init : function() {
this.m_bInited = true;
this.m_nTotalRows = 0;
this.m_nFirstRowNum = 0;
this.m_nRowsPerPage = 0;
this.m_nNumPages = 0;
this.m_nReportid = 0;
this.m_nResultNumStart = 0;
this.m_strStart = "";
},

foo: function() {...},
bar: function() {...}
}

This seems like a very elegant way to create classes in javascript,
gives you a constructor and lists methods as comma separated
properties.

My colleague is suspicious that there may be excessive runtime overhead
associated with the prototype, property list way of doing this.
Anybody know for sure?

View 1 Replies View Related

Array Syntax Question

Dec 15, 2006

I'm looking at some code I do not understand:

var icons = new Array();
icons[""] = new GIcon();
icons[""].image = "somefilename.png";

I read this as an array of icons is being built.

An element of the array is an object itself but what is this syntax of
the consecutive double quotes inside the brackets ?

View 2 Replies View Related

Q About Function Definition Syntax

Aug 23, 2007

I had a look at sIFR.js code after parsing it and I have a question
about function syntax. For example

var f=function(){
// statements here
}();


What is the purpose if the second set of parentheses following the
closing brace? Is the intention to execute the function immediately
after it has been defined?

Most functions in sIFR.js do not have this syntax, but a few do.

View 1 Replies View Related

Syntax For Variables Within A Namespace

Sep 11, 2007

var BN = {
foo: function() {
alert("hello world");
},
z: function() {
alert("hello world");
},
}

I would like to add a member moo to BN whose definition is

var moo = {"a":"A","b","B"};

How do I do it?

View 9 Replies View Related

Variable In Function - Syntax

Jul 20, 2005

I know only little of javascript and have trouble with the syntax of a
function this is the function

function ClipBoard( VARIABLE)
{
holdVARIABLE.innerText = VARIABLE.innerText;
Copied = holdVARIABLE.createTextRange();
Copied.execCommand("Copy");
}

probably needless to say, but it doesn't work.
How can i get this function to work?

View 3 Replies View Related

JQuery :: Difference Between :not And .not Other Than Syntax?

Nov 6, 2011

Was wondering, other then the syntax difference, should the below to bits not end up with the same result?

$("details").not("summary");
$("details :not(summary)");

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved