Re: [WSG] unobtrusive js help

2007-03-02 Thread Paul Novitski

At 3/1/2007 02:32 AM, Bob Schwartz wrote:

I am in the process of converting my javascript library to
nonobtrusive js.


...

At 3/1/2007 06:44 AM, Bob Schwartz wrote:

I'll start with the easy one first:

var d=new Date();yr=d.getFullYear();if 
(yr!=2003)document.write (copy; +yr); myplace


which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);

... etc.


Bob,

I'm glad you're getting help with your javascript problem.  However:

Unobtrusive javascript doesn't just mean 
separation of the script from the markup, it is 
also the use of javascript that doesn't break the 
page when scripting is disabled.

http://onlinetools.org/articles/unobtrusivejavascript/chapter1.html

For example, a hyperlink that reloads the page 
with new content can be morphed by javascript to 
display the new content immediately without 
returning to the server.  Regardless of whether 
javascript is enabled, the new content shows 
up.  Unobtrusive javascript enhances the page but 
the page doesn't DEPEND on javascript.


Your use of javascript to display a copyright 
notice means that the copyright won't be 
displayed when javascript isn't running.  This 
isn't unobtrusive, it's obtrusive.  It's like 
printing a book with a copyright notice that 
shows up only in artificial light but is 
invisible in daylight.  I can't imagine you're 
protecting your client's intellectual property 
rights by generating the copyright notice in such 
a fragile way.  Please generate the notice 
server-side -- or hard-code it into the html -- 
so it shows up for everyone viewing the content.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-02 Thread Tim

On 02/03/2007, at 6:34 PM, Paul Novitski wrote:


At 3/1/2007 02:32 AM, Bob Schwartz wrote:

I am in the process of converting my javascript library to
nonobtrusive js.


...

At 3/1/2007 06:44 AM, Bob Schwartz wrote:

I'll start with the easy one first:

var d=new Date();yr=d.getFullYear();if (yr!=2003)document.write 
(copy; +yr); myplace


which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);

... etc.


Bob,

I'm glad you're getting help with your javascript problem.  However:

Unobtrusive javascript doesn't just mean separation of the script from 
the markup, it is also the use of javascript that doesn't break the 
page when scripting is disabled.

http://onlinetools.org/articles/unobtrusivejavascript/chapter1.html

For example, a hyperlink that reloads the page with new content can be 
morphed by javascript to display the new content immediately without 
returning to the server.  Regardless of whether javascript is enabled, 
the new content shows up.  Unobtrusive javascript enhances the page 
but the page doesn't DEPEND on javascript.


Your use of javascript to display a copyright notice means that the 
copyright won't be displayed when javascript isn't running.  This 
isn't unobtrusive, it's obtrusive.  It's like printing a book with a 
copyright notice that shows up only in artificial light but is 
invisible in daylight.  I can't imagine you're protecting your 
client's intellectual property rights by generating the copyright 
notice in such a fragile way.  Please generate the notice server-side 
-- or hard-code it into the html -- so it shows up for everyone 
viewing the content.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***





Thanks Paul,

Also consider in the head meta tags, a link to copyright statement:
link rel=Copyright href=Copyright.html /

And in the page body put somewhere
copy; myplace 2007.

Add the copyright statement for non javascript users
 noscriptcopy; myplace 2007. /noscript

Tim

The Editor
Heretic Press
http://www.hereticpress.com
Email [EMAIL PROTECTED]



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-02 Thread Bob Schwartz

Paul,

I agree with you and as I am trying to learn this stuff I'm going one  
step at a time in the hopes that I can one day drop the crutches I  
needed an example of how to put a js string in a text string.


The next step will be to try and figure out how (I have some examples  
that I am playing with) to replace existing text with that generated  
by the js.


The idea being: hard coded in the page would be © 2003 - 2007  
Myplace, (the 2003 being the year the site went live) then on Jan.  
1st 2008 the js would replace the 2007 with 2008, but if js is turned  
off it would still say 2007 until such time as the hard coding can be  
changed.


Is there a server side way of doing it without turning the whole site  
into PHP or ASP?


Thanks,

Bob




Bob,

I'm glad you're getting help with your javascript problem.  However:

Unobtrusive javascript doesn't just mean separation of the script  
from the markup, it is also the use of javascript that doesn't  
break the page when scripting is disabled.

http://onlinetools.org/articles/unobtrusivejavascript/chapter1.html

For example, a hyperlink that reloads the page with new content can  
be morphed by javascript to display the new content immediately  
without returning to the server.  Regardless of whether javascript  
is enabled, the new content shows up.  Unobtrusive javascript  
enhances the page but the page doesn't DEPEND on javascript.


Your use of javascript to display a copyright notice means that the  
copyright won't be displayed when javascript isn't running.  This  
isn't unobtrusive, it's obtrusive.  It's like printing a book with  
a copyright notice that shows up only in artificial light but is  
invisible in daylight.  I can't imagine you're protecting your  
client's intellectual property rights by generating the copyright  
notice in such a fragile way.  Please generate the notice server- 
side -- or hard-code it into the html -- so it shows up for  
everyone viewing the content.


Regards,

Paul




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-02 Thread Michael Cordover

On 3/2/07, Paul Novitski [EMAIL PROTECTED] wrote:

Please generate the notice
server-side -- or hard-code it into the html --
so it shows up for everyone viewing the content.


In addition to Paul's technically valid note (with which I, a noscript
user, wholeheartedly agree), there's also a legal one. The year in a
copyright notice should be the year of last revision. Coding it in
with JavaScript will keep it up to date when it may not be, which
would be a false copyright claim. Not so good. Make it the year of
last modification of the page - either the data presented by a
server-side script, or hard-coded when the page is changed.

Regards,

Michael


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-02 Thread Bob Schwartz

Paul,

Unobtrusive javascript doesn't just mean separation of the script  
from the markup, it is also the use of javascript that doesn't  
break the page when scripting is disabled.

http://onlinetools.org/articles/unobtrusivejavascript/chapter1.html


Further thoughts on this statement:

Leaving aside the copyright  bit, I'm not so sure it is necessary to  
cater 100% to those without js as long as they are not being denied  
the primary content.


An example: I am working on a script that generates a random quote in  
the right column of a page. If js is turned off nothing will show.


However, that quote is not essential to the content of the site, it  
is just a bit of eye candy that the user with js turned off will not  
see and I don't see any reason to jump through hoops to try and give  
the non-js person something to see in its place.


I am, however, trying to get away from js that does affect the  
primary content if turned off.


 It's like printing a book with a copyright notice that shows up  
only in artificial light but is invisible in daylight.


To use your book example: desiging a site is like laying out a book  
according to a certian look and feel if published as designed, but  
having to take into consideration  the fact that the possibility  
exists that it will be published with different fonts-at different  
sizes, no images, different page sizes, browser bugs etc., etc.,  
etc. At some point we either draw some lines (often due to budget,  
client requests) or just publish plain text web pages.


I have recently started trying to create the perfect template to  
use as a starting point for future web sites.


I have been reading all the various arguments regarding font sizes,  
html vs xhtml served as text/html, etc., etc. only to discover that  
many of the gurus are now reversing themselves on what is right  
or ignoring some very strong and convincing arguments (backed up by  
examples) as to why their method is not the method to follow.


It is a frustrating experience and in the end I'll probably just have  
to draw my own conclusions, as well as, lines.


Bob


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-02 Thread Bob Schwartz

Michael,

Thank you for the information.

If we were in a perfect world it just might be reasonable to try and  
be as legal as possible, but reality is that the copyright notice is  
almost useless in that it only gives a (false) sense of protection,  
to actualy be protected is another matter.


As a professional photographer I have had occasion to pursue  
copyright violations.


Yes, the law is on my side, but due to the cost of lawyers, the  
violaters being in a different country, difficulty collecting even if  
I win the case, etc. it's rarely worth pursuing.


So, in good faith, I put the copyright on clients sites, but as the  
saying goes it is as useful as tits on a bull.



On 3/2/07, Paul Novitski [EMAIL PROTECTED] wrote:

Please generate the notice
server-side -- or hard-code it into the html --
so it shows up for everyone viewing the content.


In addition to Paul's technically valid note (with which I, a noscript
user, wholeheartedly agree), there's also a legal one. The year in a
copyright notice should be the year of last revision. Coding it in
with JavaScript will keep it up to date when it may not be, which
would be a false copyright claim. Not so good. Make it the year of
last modification of the page - either the data presented by a
server-side script, or hard-coded when the page is changed.

Regards,

Michael


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***






***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-02 Thread Bob Schwartz

Michael,

Another point. All the sites I do have something in them updated at  
least once a year, so the copyright (current year) would reflect the  
year of last revision.



On 3/2/07, Paul Novitski [EMAIL PROTECTED] wrote:

Please generate the notice
server-side -- or hard-code it into the html --
so it shows up for everyone viewing the content.


In addition to Paul's technically valid note (with which I, a noscript
user, wholeheartedly agree), there's also a legal one. The year in a
copyright notice should be the year of last revision. Coding it in
with JavaScript will keep it up to date when it may not be, which
would be a false copyright claim. Not so good. Make it the year of
last modification of the page - either the data presented by a
server-side script, or hard-coded when the page is changed.

Regards,

Michael


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***






***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



[WSG] unobtrusive js help

2007-03-01 Thread Bob Schwartz
I am in the process of converting my javascript library to  
nonobtrusive js.


I bought a few books and with them, managed to convert most, but I  
still have a few that defy my very limited skills.


Where could I go for help in converting these?

Thanks.



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Mordechai Peller

Bob Schwartz wrote:
I am in the process of converting my javascript library to 
nonobtrusive js.


Where could I go for help in converting these? 

Here, for one place. Can you be more specific about the problems?


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Darren West

You will find these books very helpful

http://www.amazon.co.uk/DOM-Scripting-Design-JavaScript-Document/dp/1590595335/ref=pd_ka_1/202-6135156-2275021?ie=UTF8s=booksqid=1172759335sr=8-1
http://www.amazon.co.uk/JavaScript-Anthology-Essential-Tricks-Hacks/dp/0975240269/ref=pd_ka_1/202-6135156-2275021?ie=UTF8s=booksqid=1172759353sr=8-1
http://www.amazon.co.uk/JavaScript-Definitive-Guide-David-Flanagan/dp/0596101996/ref=pd_ka_1/202-6135156-2275021?ie=UTF8s=booksqid=1172759366sr=8-1

Darren

On 01/03/07, Mordechai Peller [EMAIL PROTECTED] wrote:


Bob Schwartz wrote:
 I am in the process of converting my javascript library to
 nonobtrusive js.

 Where could I go for help in converting these?
Here, for one place. Can you be more specific about the problems?


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***





***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***

Re: [WSG] unobtrusive js help

2007-03-01 Thread Bob Schwartz

Thanks Mordechai,

I'll start with the easy one first:

var d=new Date();yr=d.getFullYear();if (yr!=2003)document.write 
(copy; +yr); myplace


which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);
  var txt1 = document.createTextNode(copy; );
   var year = new Date().getFullYear();
   var now = year;
   var txt2 = document.createTextNode()
  var txt3 = document.createTextNode( FIFe);
  para.appendChild(txt1);
  para.appendChild(txt2);
  para.appendChild(txt3);
  var testdiv = document.getElementById(testdiv);
  testdiv.appendChild(para);
}

and think I know where it is wrong
I need to get it to write the year (ex-document +yr) in the () of the  
txt2 node, but I don't know how to do it.


I also don't think the if (yr!=2003) from the old js is necessary,  
but I may be wrong



Bob Schwartz wrote:
I am in the process of converting my javascript library to  
nonobtrusive js.


Where could I go for help in converting these?

Here, for one place. Can you be more specific about the problems?


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***






***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Bob Schwartz
Have one of them, DOM Scripting, which got me to where I am, I'll  
check out the other two.


Thanks


You will find these books very helpful

http://www.amazon.co.uk/DOM-Scripting-Design-JavaScript-Document/dp/ 
1590595335/ref=pd_ka_1/202-6135156-2275021? 
ie=UTF8s=booksqid=1172759335sr=8-1
http://www.amazon.co.uk/JavaScript-Anthology-Essential-Tricks-Hacks/ 
dp/0975240269/ref=pd_ka_1/202-6135156-2275021? 
ie=UTF8s=booksqid=1172759353sr=8-1
http://www.amazon.co.uk/JavaScript-Definitive-Guide-David-Flanagan/ 
dp/0596101996/ref=pd_ka_1/202-6135156-2275021? 
ie=UTF8s=booksqid=1172759366sr=8-1


Darren

On 01/03/07, Mordechai Peller [EMAIL PROTECTED] wrote:
Bob Schwartz wrote:
 I am in the process of converting my javascript library to
 nonobtrusive js.

 Where could I go for help in converting these?
Here, for one place. Can you be more specific about the problems?


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***

Re: [WSG] unobtrusive js help

2007-03-01 Thread Bruce

Bob Schwartz wrote:
I am in the process of converting my javascript library to  nonobtrusive 
js.


Where could I go for help in converting these?


Perhaps related:
http://redotheweb.com/2007/02/28/unobtrusive-javascript-made-possible/

Bruce P
bkdesign

- Original Message - 
From: Bob Schwartz [EMAIL PROTECTED]

To: wsg@webstandardsgroup.org
Sent: Thursday, March 01, 2007 9:44 AM
Subject: Re: [WSG] unobtrusive js help


Thanks Mordechai,

I'll start with the easy one first:

var d=new Date();yr=d.getFullYear();if (yr!=2003)document.write
(copy; +yr); myplace

which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);
  var txt1 = document.createTextNode(copy; );
   var year = new Date().getFullYear();
   var now = year;
   var txt2 = document.createTextNode()
  var txt3 = document.createTextNode( FIFe);
  para.appendChild(txt1);
  para.appendChild(txt2);
  para.appendChild(txt3);
  var testdiv = document.getElementById(testdiv);
  testdiv.appendChild(para);
}

and think I know where it is wrong
I need to get it to write the year (ex-document +yr) in the () of the
txt2 node, but I don't know how to do it.

I also don't think the if (yr!=2003) from the old js is necessary,
but I may be wrong


Bob Schwartz wrote:
I am in the process of converting my javascript library to  nonobtrusive 
js.


Where could I go for help in converting these?

Here, for one place. Can you be more specific about the problems?


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***






***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Nick Fitzsimons

On 1 Mar 2007, at 14:44:59, Bob Schwartz wrote:

var d=new Date();yr=d.getFullYear();if (yr!=2003)document.write 
(copy; +yr); myplace


which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);
  var txt1 = document.createTextNode(copy; );
   var year = new Date().getFullYear();
   var now = year;
   var txt2 = document.createTextNode()
  var txt3 = document.createTextNode( FIFe);
  para.appendChild(txt1);
  para.appendChild(txt2);
  para.appendChild(txt3);
  var testdiv = document.getElementById(testdiv);
  testdiv.appendChild(para);
}



Not sure how FIFe fits into all this, but...

window.onload = function() {
   var year = new Date().getFullYear();
   var text = ©  + year +  myplace);
   var p = document.createElement(p);
   p.appendChild(document.createTextNode(text));
   document.getElementById(testdiv).appendChild(p);
}

should do what the original code does. If somebody gets a time  
machine up and running and goes back to 2003, well, they'll see the  
version of the site from back then anyway, so that's OK :-)


HTH,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Rolf SF


On Mar 1, 2007, at 6:53 AM, Bob Schwartz wrote:



On 01/03/07, Mordechai Peller [EMAIL PROTECTED] wrote:
Bob Schwartz wrote:
 I am in the process of converting my javascript library to
 nonobtrusive js.

 Where could I go for help in converting these?
Here, for one place. Can you be more specific about the problems?





You might want to head over to the jQuery community - it's a very  
helpful community with a lot of unobtrusive js'ers


About jQuery:   http://www.jquery.com
jQuery Discussion:  http://www.nabble.com/JQuery-f15494.html

Rolf

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***

Re: [WSG] unobtrusive js help

2007-03-01 Thread Bob Schwartz

 Nick,

Thanks. Now that I see how you have done it, I may be able to guess  
my way through the others I have to do.


Is there a ( missing in the second line of your version?


On 1 Mar 2007, at 14:44:59, Bob Schwartz wrote:

var d=new Date();yr=d.getFullYear();if (yr!=2003)document.write 
(copy; +yr); myplace


which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);
  var txt1 = document.createTextNode(copy; );
   var year = new Date().getFullYear();
   var now = year;
   var txt2 = document.createTextNode()
  var txt3 = document.createTextNode( FIFe);
  para.appendChild(txt1);
  para.appendChild(txt2);
  para.appendChild(txt3);
  var testdiv = document.getElementById(testdiv);
  testdiv.appendChild(para);
}



Not sure how FIFe fits into all this, but...

window.onload = function() {
   var year = new Date().getFullYear();
   var text = ©  + year +  myplace);
   var p = document.createElement(p);
   p.appendChild(document.createTextNode(text));
   document.getElementById(testdiv).appendChild(p);
}

should do what the original code does. If somebody gets a time  
machine up and running and goes back to 2003, well, they'll see the  
version of the site from back then anyway, so that's OK :-)


HTH,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***






***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Bob Schwartz

Rolf ,

Thanks for the info.



On Mar 1, 2007, at 6:53 AM, Bob Schwartz wrote:



On 01/03/07, Mordechai Peller [EMAIL PROTECTED] wrote:
Bob Schwartz wrote:
 I am in the process of converting my javascript library to
 nonobtrusive js.

 Where could I go for help in converting these?
Here, for one place. Can you be more specific about the problems?





You might want to head over to the jQuery community - it's a very  
helpful community with a lot of unobtrusive js'ers


About jQuery:   http://www.jquery.com
jQuery Discussion:  http://www.nabble.com/JQuery-f15494.html

Rolf

***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***

Re: [WSG] unobtrusive js help

2007-03-01 Thread Mordechai Peller

Nick Fitzsimons wrote:

On 1 Mar 2007, at 14:44:59, Bob Schwartz wrote:

var d=new Date();yr=d.getFullYear();if 
(yr!=2003)document.write(copy; +yr); myplace


which gives me: © 2007 myplace

Here's my pathetic attempt:

window.onload = function() {
  var para = document.createElement(p);
  var txt1 = document.createTextNode(copy; );
   var year = new Date().getFullYear();
   var now = year;
   var txt2 = document.createTextNode()
  var txt3 = document.createTextNode( FIFe);
  para.appendChild(txt1);
  para.appendChild(txt2);
  para.appendChild(txt3);
  var testdiv = document.getElementById(testdiv);
  testdiv.appendChild(para);
}



Not sure how FIFe fits into all this, but...

window.onload = function() {
   var year = new Date().getFullYear();
   var text = ©  + year +  myplace);
   var p = document.createElement(p);
   p.appendChild(document.createTextNode(text));
   document.getElementById(testdiv).appendChild(p);
}

should do what the original code does. If somebody gets a time machine 
up and running and goes back to 2003, well, they'll see the version of 
the site from back then anyway, so that's OK :-)
Personally, I don't think that the copyright information should be be 
generated client side. But putting that issue aside...


I would shorten it by one line since year isn't needed:

var text = copy;  + (new Date()).getFullYear() +  myplace);

The parenthesis around new Date() aren't needed, but I thinks it makes 
it a little clearer. While there are some parts of the order of 
presidents that everyone should know, where new ranks versus . 
(they're equal) isn't as important.




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Nick Fitzsimons

On 1 Mar 2007, at 20:03:30, Mordechai Peller wrote:


Nick Fitzsimons wrote:


window.onload = function() {
   var year = new Date().getFullYear();
   var text = ©  + year +  myplace);
   var p = document.createElement(p);
   p.appendChild(document.createTextNode(text));
   document.getElementById(testdiv).appendChild(p);
}



I would shorten it by one line since year isn't needed:

var text = copy;  + (new Date()).getFullYear() +  myplace);


Agreed, but I tend to avoid early optimisation when writing examples,  
as I think they should go step-by-step to make it easier for people  
to follow. On the other hand, I'd completely abandoned that principle  
by the last two lines :-)


Regards,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***



Re: [WSG] unobtrusive js help

2007-03-01 Thread Mordechai Peller

Nick Fitzsimons wrote:

On 1 Mar 2007, at 20:03:30, Mordechai Peller wrote:


Nick Fitzsimons wrote:


window.onload = function() {
   var year = new Date().getFullYear();
   var text = ©  + year +  myplace);
   var p = document.createElement(p);
   p.appendChild(document.createTextNode(text));
   document.getElementById(testdiv).appendChild(p);
}



I would shorten it by one line since year isn't needed:

var text = copy;  + (new Date()).getFullYear() +  myplace);


Agreed, but I tend to avoid early optimisation when writing examples, 
as I think they should go step-by-step to make it easier for people to 
follow. On the other hand, I'd completely abandoned that principle by 
the last two lines :-)
In principle, I agree, but I also think it's better to give a more 
proper example, so long as it remains clear. I wouldn't recommend using 
as an example:


window.onload = function() {
   
document.getElementById(testdiv).appendChild(document.createElement(p).
   appendChild(document.createTextNode(copy;  + new 
Date().getFullYear() +  myplace));

}

I'm not sure if I would even write some thing like that, though, it is 
tempting at times. ;-)



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
***