Miroslav Rovis

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromMiroslav Rovis
ToMe
Subjecta small typo
Date17 April 2005 23:43
...Small typo, but sufficient to mislead an (absolute) beginner:
In the
http://www.howtocreate.co.uk/jslibs/htmlhigh/showhidelevels.html
script,
(showhidelevels.js the script's name)
 you refer to
showhide.js (not the script's name)
I'll let you know if I make it to use that, and the more advanced one on
my pages... Will take time. Will? It is taking already!
Keep that site around for long yet, it may turn be the greatest free lunch
you ever treated lots of people, now that you're in making money that
justifies all you time with ...Visual Basic ;-)
Miro
FromMe
ToMiroslav Rovis
SubjectRe: a small typo
Date18 April 2005 22:05
Miro,

> http://www.howtocreate.co.uk/jslibs/htmlhigh/showhidelevels.html
> script, (showhidelevels.js the script's name)
>  you refer to showhide.js (not the script's name)

oops. fixed. Thanks. And thankyou for your kind words.

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromMiroslav Rovis
ToMe
Subjecta mistake or I miss clue?
Date17 April 2005 23:43
Tarquin,
On your page:
http://www.howtocreate.co.uk/tutorials/javascript/controls
PASTING
for( myVariable = 1; myVariable <= 5; myVariable++ ) {
    myArray[myVariable] = 1;
}

myArray[1] to myArray[5] are now 1.

Because I put myVariable++, myVariable would increment each time it reached
the end of the 'for' loop. If I had put ++myVariable, myVariable would have
incremented each time it reached the start of the 'for' loop so the overall
result would have been that myArray[2] to myArray[6] would be 1.
PASTED
----------------------------------------------
I tried to test it like this:

for( myVariable = 1; myVariable <= 5; ++myVariable ) {
document.writeln("<p>Value of preincremented myVariable : "+myVariable+" <\/p>");
}

for( myVariable = 1; myVariable <= 5; myVariable++ ) {
document.writeln("<p>Value of postincremented myVariable : "+myVariable+" <\/p>");
}
----------------------------------------------
or like this:
----------------------------------------------
var  myArray = new Array();
for( myVariable = 1; myVariable <= 5; ++myVariable ) {
    myArray[myVariable] = 1;
document.writeln("<p>Values  of preincremented myVariable : "+myVariable+" ,
	 and of myArray[myVariable]: "+myArray[myVariable]+" <\/p>");
}
for( myVariable = 1; myVariable <= 5; myVariable++ ) {
    myArray[myVariable] = 1;
document.writeln("<p>Values  of postincremented myVariable : "+myVariable+" ,
	 and of myArray[myVariable]: "+myArray[myVariable]+" <\/p>");
}
----------------------------------------------
In both cases I got the same result (in all the few different browsers I
tried).

A mistake of yours or am I missing a clue?
In case this would get messed in the mail, I am including the two
corresponding files as attachments.
Anyways, still pondering over lots of useful things you explained on your
site... but I way longer time to get it than more talented people...
Consider that I am 48, and knew nothing about Internet till I was 41...
Miro
FromMe
ToMiroslav Rovis
SubjectRe: a mistake or I miss clue?
Date21 April 2005 16:43
Miroslav,

> If I had put ++myVariable, myVariable would have incremented each time it
> reached the start of the 'for' loop

> A mistake of yours or am I missing a clue?

A mistake of mine. (I thought I had fixed it, but apparently it snuck back
in ;) ) The third parameter of the for loop is always run at the end of the
loop. In this particular instance, it makes no difference whether the ++ is
before or after the variable name.

++foo vs foo++ only makes a difference inside expressions where it is used
and incremented at the same time (in the for loop, it is only incremented,
not used), for example:

var foo = 0, bar = new Array();
bar[foo++] = true; //use, then increment

-> bar[0] = true;

var foo = 0, bar = new Array();
bar[++foo] = true; //increment, then use

-> bar[1] = true;

Thanks for letting me know about the mistake. I will update the page.
FromMiroslav Rovis
ToMe
Subjecttypo make the example less clear, and other
Date22 April 2005 15:59
Tarquin,
http://www.howtocreate.co.uk/tutorials/javascript/functions
In this part:
function functionName(varable1,variable2) {
 etc.
varable1 repeates later as such, but not variable2,
instead: varable2

Once all varables become variables, all is fine.

And possibly other varables on that page should be replaced so.
---------------------------------------------------------------
---------------------------------------------------------------
And other:
http://www.howtocreate.co.uk/tutorials/javascript/controls
"try - catch - finally" fine.
But "throw( myError );" (or is it myEr? -- I couldn't get it even by making
all instances the latter nor the former way)
---------------------------------------------------------------
I put this code inside script tags inside HTML body:
var myEr = new Object();
myEr.name = 'My error';
myEr.message = 'You did something I didn\'t like';
throw( myEr );
document.writeln("<p>Writing any? "+myEr.name + ': ' + myEr.message+" <\/p>");
---------------------------------------------------------------
And I put this code inside script tags in the head:
var myEr = new Object();
myEr.name = 'My error';
myEr.message = 'You did something I didn\'t like';
and put this in the body:
  <p><a href="#" onClick="javascript:throw(myEr);
  document.writeln('<p>Writing any? ' + myEr.name + myEr.message+ ' <\/p>');
  	">Click here!</a></p>
---------------------------------------------------------------
I enclose these two files as attachments. What clue do I possibly miss?
---------------------------------------------------------------
---------------------------------------------------------------
I generally can test code in
 on Windows: almost any IE (3-6), Netscapes 4.08/4.8/6/7.? Opera 7.?
 on Linux: Mozilla 1.7b Konqueror 3.2 lynx
(of course this time I dodn't test on lynx ;-)

The following is not my site, but I suggest that you leave the link, only
this one at least, for your readers to find: http://browsers.evolt.org/
My suggestion to the gentle reader is, as far as Internet Explorer versions
are in question, go for the standalone versions!
This is where it started (consider it carefully):
[url]
That way, Taquin, people will be able to more easily test your code on
different browsers.

Thanx!
Miro
FromMe
ToMiroslav Rovis
SubjectRe: typo make the example less clear, and other
Date22 April 2005 17:04
Miroslav,

Eagle eyed as ever ;) well seen.

> varable1

fixed.

> "throw( myError );"

I have reworded that section to make it (hopefully) a lot more clear, and
to correct the mistake in the variable names.

> http://browsers.evolt.org/
> [url]

indeed. I will add these to my links page.

cheers

Tarquin
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.