Re: [PHP] OT Re: [PHP] javascript in head or in body ?

2007-08-13 Thread Daniel Brown
On 8/12/07, tedd [EMAIL PROTECTED] wrote:
 For example, if your wife says (and you're not listening as usual)
 Do these pants make my butt look big? Neither answer is going to
 help much. But, if said separately, you at least have a chance of
 surviving the ordeal.

And I'll also point out that they will work in either order in
most cases - including the one Tedd gave as an example.  To
demonstrate:

Do these pants make my butt look big?
Yes, dear.
WHAT?!?
I'm sorry!

- or -

Do this pants make my butt look big?
I'm sorry yes, dear.

However, note that it is NEVER alright to say one of the following:
No, your fat ass makes it look big.
No, but that second piece of cheesecake did.
Hell yeah!
How the hell did you pull those up?
I didn't want to say anything, but that's why I always want to be on top.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-12 Thread David Robley
tedd wrote:

 At 9:29 PM +0200 8/7/07, Tijnema wrote:
On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
   Yeah!! This list is for public apologies and Copyright discussion.

  Cheers,
  Rob.
  --

Oh yeah, Tedd is only the first of thousands of people that need to
apologize... :P

Tijnema
 
 
 Ah crap, have I got something else to apologize for?
 
 At this rate, by the time I reach the end of my life, I'll know only
 two sentences, namely I'm sorry and Yes, Dear.

Seems to me you could rather easily condense that to just one sentence with
the same degree of functionality. :-)




Cheers
-- 
David Robley

This isn't hell, but I can see it from here.
Today is Prickle-Prickle, the 5th day of Bureaucracy in the YOLD 3173. 
Celebrate Zaraday

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-12 Thread tedd

At 1:26 PM -0400 8/11/07, Robert Cummings wrote:

On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
  Always (fishing for another apology opportunity) place javascript in

 external files and call them in via the header. Keep the code
 unobtrusive. There are ways to use javascript without having to mix
 it into your html -- look up DOM scripting.


I absolutely agree with unobtrusive JavaScript, but I do disagree with
you slightly on using external files. Generally speaking i keep large
bits of code (Especially libs) in external files, but a few lines of
script for a form that appears on one page I'll often be put in the head
section. This way the JavaScript is in the same file as the template for
which it is associated. My template engine will relocate the JavaScript
to the head section at compile time.


That's clever. I assume that for production work (i.e., for a 
client), you can isolate the files you need and be totally 
unobtrusive if you want.


I just described my method off-list to another person and it went like this:

I have a system for my site development work such that I simply 
include one header and one footer and no matter where the project 
directory is that I'm currently working on, the process will find the 
one main common header and common footer and will add them to my demo 
automagically.


My code to start, looks like this:

?php include('../header.php') ?
   h1 Hi /h1
?php include('../footer.php') ?

From there I have a complete page -- from doctype to copyright, it's 
all there and it validates.


If I need a javascript file locally, then I add it to the local 
working directory by naming the file a.js. Likewise, if I need an 
additional css file, then I name it a.css and it's also included in 
the call.


However, if I don't need those files, then none are included in my 
local working directory and attempts to load those files will fail -- 
however -- it doesn't matter if an attempt to load fails or not as 
long as the files are not needed.


I think that's kind of clever, but I like Rocky and Bullwinkle as well.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] OT Re: [PHP] javascript in head or in body ?

2007-08-12 Thread tedd

At 10:21 PM +0930 8/12/07, David Robley wrote:

tedd wrote:

 

 At this rate, by the time I reach the end of my life, I'll know only
 two sentences, namely I'm sorry and Yes, Dear.


Seems to me you could rather easily condense that to just one sentence with
the same degree of functionality. :-)



Unfortunately, it doesn't work that way. You must keep them in two 
separate sentences.


For example, if your wife says (and you're not listening as usual) 
Do these pants make my butt look big? Neither answer is going to 
help much. But, if said separately, you at least have a chance of 
surviving the ordeal.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-12 Thread Robert Cummings
On Sun, 2007-08-12 at 21:27 -0400, tedd wrote:
 At 1:26 PM -0400 8/11/07, Robert Cummings wrote:
 On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
Always (fishing for another apology opportunity) place javascript in
   external files and call them in via the header. Keep the code
   unobtrusive. There are ways to use javascript without having to mix
   it into your html -- look up DOM scripting.
 
 I absolutely agree with unobtrusive JavaScript, but I do disagree with
 you slightly on using external files. Generally speaking i keep large
 bits of code (Especially libs) in external files, but a few lines of
 script for a form that appears on one page I'll often be put in the head
 section. This way the JavaScript is in the same file as the template for
 which it is associated. My template engine will relocate the JavaScript
 to the head section at compile time.
 
 That's clever. I assume that for production work (i.e., for a 
 client), you can isolate the files you need and be totally 
 unobtrusive if you want.
 
 I just described my method off-list to another person and it went like this:
 
 I have a system for my site development work such that I simply 
 include one header and one footer and no matter where the project 
 directory is that I'm currently working on, the process will find the 
 one main common header and common footer and will add them to my demo 
 automagically.
 
 My code to start, looks like this:
 
 ?php include('../header.php') ?
 h1 Hi /h1
 ?php include('../footer.php') ?
 
  From there I have a complete page -- from doctype to copyright, it's 
 all there and it validates.
 
 If I need a javascript file locally, then I add it to the local 
 working directory by naming the file a.js. Likewise, if I need an 
 additional css file, then I name it a.css and it's also included in 
 the call.
 
 However, if I don't need those files, then none are included in my 
 local working directory and attempts to load those files will fail -- 
 however -- it doesn't matter if an attempt to load fails or not as 
 long as the files are not needed.
 
 I think that's kind of clever, but I like Rocky and Bullwinkle as well.

I don't use a script to find my JavaScript files and CSS but I do
something similar to your includes for header and footer. The difference
being that my template engine will pull them in at compile time and not
at run-time. A lot of static content is pulled in this way and relocated
using compile-time accumulators. Then I use run-time accumulators to
flush content at run-time into the appropriate areas if necessary. This
allows me to create a layout that is compiled once at compile time but
with flush hooks for run-time. For instance for simplicity I use the
following tag in the head area to set up JavaScript:

jinn:javaScriptSystem/

This is the same as doing the following manually:


jinn:accumulatorFlush name=javaScriptTags/
jinn:accumulatorFlush name=javaScriptTags dynamic=true/

jinn:javaScript
jinn:accumulatorFlush name=javaScript/
jinn:accumulatorFlush name=javaScript dynamic=true/

function javaScriptOnLoad()
{
jinn:accumulatorFlush name=javaScriptOnLoad/
jinn:accumulatorFlush name=javaScriptOnLoad dynamic=true/
}

/jinn:javaScript
-

The body tag will have an onload=javaScriptOnLoad(). Then in a content
file I can add the following:

jinn:accumulate name=javaScriptOnLoad

// some javascript code to modify the DOM

/jinn:accumulate

And it will get relocated at compile time to the location of the static
flush statement: jinn:accumulatorFlush name=javaScriptOnLoad/

Similarly within my code at run-time I can do the following:

$mAcc = $this-getServiceRef( 'accManager' );
$acc = $mAcc-getRef( 'javaScriptOnLoad' );

$acc-append
(
' // some javascript to modify the DOM '
)

And it will be get flushed into the content at the location of the
dynamic flush statement:

jinn:accumulatorFlush name=javaScriptOnLoad dynamic=true/

So all in all, it's very simple for me to put JavaScript (and any
content for that matter) anywhere I please. I often use it for layout
areas (such as left pane, right pane, etc), menus, visitor notices, etc.

BTW if you're wondering why I have a jinn:javaScript tag it's because
who wants to remember the following:

---
script type=text/javascript!--//--![CDATA[//!--

//--!]]/script
---

:)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-11 Thread tedd

At 9:29 PM +0200 8/7/07, Tijnema wrote:

On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
  Yeah!! This list is for public apologies and Copyright discussion.


 Cheers,
 Rob.
 --


Oh yeah, Tedd is only the first of thousands of people that need to
apologize... :P

Tijnema



Ah crap, have I got something else to apologize for?

At this rate, by the time I reach the end of my life, I'll know only 
two sentences, namely I'm sorry and Yes, Dear.


Oh, to bring this off-topic question back to on-topic (?)

Always (fishing for another apology opportunity) place javascript in 
external files and call them in via the header. Keep the code 
unobtrusive. There are ways to use javascript without having to mix 
it into your html -- look up DOM scripting.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-11 Thread Robert Cummings
On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
 At 9:29 PM +0200 8/7/07, Tijnema wrote:
 On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
Yeah!! This list is for public apologies and Copyright discussion.
 
   Cheers,
   Rob.
   --
 
 Oh yeah, Tedd is only the first of thousands of people that need to
 apologize... :P
 
 Tijnema
 
 
 Ah crap, have I got something else to apologize for?
 
 At this rate, by the time I reach the end of my life, I'll know only 
 two sentences, namely I'm sorry and Yes, Dear.
 
 Oh, to bring this off-topic question back to on-topic (?)
 
 Always (fishing for another apology opportunity) place javascript in 
 external files and call them in via the header. Keep the code 
 unobtrusive. There are ways to use javascript without having to mix 
 it into your html -- look up DOM scripting.

I absolutely agree with unobtrusive JavaScript, but I do disagree with
you slightly on using external files. Generally speaking i keep large
bits of code (Especially libs) in external files, but a few lines of
script for a form that appears on one page I'll often be put in the head
section. This way the JavaScript is in the same file as the template for
which it is associated. My template engine will relocate the JavaScript
to the head section at compile time.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] javascript in head or in body ?

2007-08-07 Thread C.R.Vegelin
Are there any rules when to include javascript in head or in body ?
For example, 
script type=text/javascript
function reload(form)
{  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value; 
   self.location='QueryForm.php?Chapter=' + val ;
}
/script

TIA, Cor


Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Tijnema
On 8/7/07, C.R.Vegelin [EMAIL PROTECTED] wrote:
 Are there any rules when to include javascript in head or in body ?
 For example,
 script type=text/javascript
 function reload(form)
 {  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
   self.location='QueryForm.php?Chapter=' + val ;
 }
 /script

 TIA, Cor


Uhh, do you know which list this is?

Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Greg Donald
On 8/7/07, C.R.Vegelin [EMAIL PROTECTED] wrote:
 Are there any rules when to include javascript in head or in body ?
 For example,
 script type=text/javascript
 function reload(form)
 {  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
self.location='QueryForm.php?Chapter=' + val ;
 }
 /script

w3 says it can appear in either:

snip
The SCRIPT element places a script within a document. This element may
appear any number of times in the HEAD or BODY of an HTML document.
/snip

http://www.w3.org/TR/html4/interact/scripts.html#h-18.1


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 21:24 +0200, Tijnema wrote:
 On 8/7/07, C.R.Vegelin [EMAIL PROTECTED] wrote:
  Are there any rules when to include javascript in head or in body ?
  For example,
  script type=text/javascript
  function reload(form)
  {  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
self.location='QueryForm.php?Chapter=' + val ;
  }
  /script
 
  TIA, Cor
 
 
 Uhh, do you know which list this is?

Yeah!! This list is for public apologies and Copyright discussion.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Tijnema
On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
 On Tue, 2007-08-07 at 21:24 +0200, Tijnema wrote:
  On 8/7/07, C.R.Vegelin [EMAIL PROTECTED] wrote:
   Are there any rules when to include javascript in head or in body ?
   For example,
   script type=text/javascript
   function reload(form)
   {  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
 self.location='QueryForm.php?Chapter=' + val ;
   }
   /script
  
   TIA, Cor
  
 
  Uhh, do you know which list this is?

 Yeah!! This list is for public apologies and Copyright discussion.

 Cheers,
 Rob.
 --

Oh yeah, Tedd is only the first of thousands of people that need to
apologize... :P

Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Richard Heyes

C.R.Vegelin wrote:

Are there any rules when to include javascript in head or in body ?
For example, 
script type=text/javascript

function reload(form)
{  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value; 
   self.location='QueryForm.php?Chapter=' + val ;

}
/script


Either really. Both work.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread brian

C.R.Vegelin wrote:

Are there any rules when to include javascript in head or in body ?
For example, 
script type=text/javascript

function reload(form)
{  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value; 
   self.location='QueryForm.php?Chapter=' + val ;

}
/script



Generally, script blocks outside of the head are meant to be used for 
routines that run as the page is loading. For example, one might have 
some JS that creates some block of HTML or something. Or one might have 
a JS block at the very end of the page that is meant to run once the 
page has (almost) completed loading. Why people do this, i'm not sure. 
Personally, i think script blocks belong in the head. If you have some 
function that needs to run at page load, there's the onload handler for 
that.


In your case, it looks like that function could be placed pretty much 
anywhere, as it can only be called once the page has loaded, anyway. Is 
your problem that you can't change the head of the page (to include that 
function) for some reason? In any case, go ahead and put it in the body.


brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Greg Donald
On 8/7/07, Tijnema [EMAIL PROTECTED] wrote:
 Uhh, do you know which list this is?

I give up..  Is it the one where I get as many [OT] labeled emails as
I do on-topic ones?

People have been asking basic html questions here for (over?) a
decade, and it probably won't stop anytime soon.  Newcomers don't know
it's wrong because they haven't seen anyone be smacked down for it.
So until you can smack someone down in advance, it won't stop.

It's not that big a deal is it?  I mean html discussion isn't nearly
as important as a heated copyright law debate, but then my delete
button works great.

I think you just want something to bitch about.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Jason Pruim


On Aug 7, 2007, at 3:29 PM, Tijnema wrote:


On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Tue, 2007-08-07 at 21:24 +0200, Tijnema wrote:

On 8/7/07, C.R.Vegelin [EMAIL PROTECTED] wrote:
Are there any rules when to include javascript in head or in  
body ?

For example,
script type=text/javascript
function reload(form)
{  var val=form.Chapter.options 
[form.Chapter.options.selectedIndex].value;

  self.location='QueryForm.php?Chapter=' + val ;
}
/script

TIA, Cor



Uhh, do you know which list this is?


Yeah!! This list is for public apologies and Copyright discussion.

Cheers,
Rob.
--


Oh yeah, Tedd is only the first of thousands of people that need to
apologize... :P


Later this week on Php-General, witness the revolutionary  
confessions of a PHP Programmer stuck in the middle of a lovers  
triangle of OOP, and Procedural




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 21:19 +0100, C.R.Vegelin wrote:
 Are there any rules when to include javascript in head or in body ?
 For example, 
 script type=text/javascript
 function reload(form)
 {  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value; 
self.location='QueryForm.php?Chapter=' + val ;
 }
 /script

In head - whenever possible
In body - whenever else

It's not incorrect to have JS in the body, but it sure makes it more
difficult to see what's happening.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Satyam

Check:

http://developer.yahoo.com/performance/rules.html

Satyam

PS:  The answer is, put styles at the top, scripts at the bottom., but there 
are many other tricks to improve performance.  Otherwise, as for the 
standards, they can go anywhere.



- Original Message - 
From: C.R.Vegelin [EMAIL PROTECTED]

To: [EMAIL PROTECTED] php-general@lists.php.net
Sent: Tuesday, August 07, 2007 10:19 PM
Subject: [PHP] javascript in head or in body ?


Are there any rules when to include javascript in head or in body ?
For example,
script type=text/javascript
function reload(form)
{  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
  self.location='QueryForm.php?Chapter=' + val ;
}
/script

TIA, Cor






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.8/940 - Release Date: 06/08/2007 
16:53


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Tijnema
On 8/7/07, Richard Heyes [EMAIL PROTECTED] wrote:
 C.R.Vegelin wrote:
  Are there any rules when to include javascript in head or in body ?
  For example,
  script type=text/javascript
  function reload(form)
  {  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
 self.location='QueryForm.php?Chapter=' + val ;
  }
  /script

 Either really. Both work.

 --
 Richard Heyes

Actually, I didn't want to answer this, but you're talking shit here ;)

Javascript needs to be initialised before it can be used.
So, if you have a function bodyload(), and you call it from body
onload=bodyload();, you need to place it inside head, as it isn't
loaded if you put it in body.
Some browsers will still run the javascript code, however it is not recommended.

Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Tijnema
On 8/7/07, Greg Donald [EMAIL PROTECTED] wrote:
 On 8/7/07, Tijnema [EMAIL PROTECTED] wrote:
  Uhh, do you know which list this is?

 I give up..  Is it the one where I get as many [OT] labeled emails as
 I do on-topic ones?

 People have been asking basic html questions here for (over?) a
 decade, and it probably won't stop anytime soon.  Newcomers don't know
 it's wrong because they haven't seen anyone be smacked down for it.
 So until you can smack someone down in advance, it won't stop.

What about a php-html list? or php-js? :P


 It's not that big a deal is it?  I mean html discussion isn't nearly
 as important as a heated copyright law debate, but then my delete
 button works great.

 I think you just want something to bitch about.

 --
 Greg Donald
 http://destiney.com/

Yep, you're right. This list has quite a lot traffic, and if all
useless topics could move to another list, the real problems could
be handled here, and we could see the forest through the trees again
;) Or however you want to call it in english ;)

Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread tg-php
Ok, you got the obligatory 'wrong list' comments.  It is the wrong list, but 
for the sake of public completeness... how about an answer to the question.

You can put it anywhere but a couple of considerations:

1. I believe if you put it AFTER where the JS functions defined in that block 
are called, it may try to call the functions before the functions appear.  So 
close to the top is always good.  I could be wrong on this, but there was some 
kind of condition along those lines and I think it was with JS and positioning.

2. Non JS compliant browsers.  If you put it in the body, they're likely to 
ignore the script tags and just blatantly display the JS as if it was meant 
for output.  This can be mitigated by using HTML comment blocks around the JS. 
Since they're different than JS comment blocks, it won't interfere with the JS. 
 But putting your script in the head block should also prevent it from 
being displayed.

3. If you're executing JS in order to output something, you're going to need to 
put it whereever in your HTML you'll need the output.  If you're just defining 
functions to be called later, then you can put it whereever (probably above 
where you're calling the functions.. see #1).

The only things we don't put in the head for script blocks is a popup 
calendar thing that the old developer installed and our users seem to like.  
Part of it's requirements is a script tag that includes some JS and HTML 
where you want the popup calendar to appear.   Could probably be streamlined, 
but works well enough and doesn't look too ugly so why make more work for 
ourselves until we do the full re-design (2035?)

-TG

= = = Original message = = =

Are there any rules when to include javascript in head or in body ?
For example, 
script type=text/javascript
function reload(form)
  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value; 
   self.location='QueryForm.php?Chapter=' + val ;

/script

TIA, Cor


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Greg Donald
On 8/7/07, Jason Pruim [EMAIL PROTECTED] wrote:
 Later this week on Php-General, witness the revolutionary
 confessions of a PHP Programmer stuck in the middle of a lovers
 triangle of OOP, and Procedural

That's a re-run.  Python wins with Ruby coming in second place.  PHP
gets renamed to Java, etc.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 15:50 -0400, [EMAIL PROTECTED] wrote:
 
 3. If you're executing JS in order to output something, you're going
 to need to put it whereever in your HTML you'll need the output.  If
 you're just defining functions to be called later, then you can put
 it whereever (probably above where you're calling the functions.. see
 #1).

That's not true. You can still have it in the head and use javascript to
target specific content to a tag with an ID.

In fact, I'd say that's a better option when used in conjunction with
onload() since you can be certain all of your libraries are loaded.
Additionally it allows you to place default content in the event that
your visitor doesn't have JavaScript enabled.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 14:58 -0500, Greg Donald wrote:
 On 8/7/07, Jason Pruim [EMAIL PROTECTED] wrote:
  Later this week on Php-General, witness the revolutionary
  confessions of a PHP Programmer stuck in the middle of a lovers
  triangle of OOP, and Procedural
 
 That's a re-run.  Python wins with Ruby coming in second place.  PHP
 gets renamed to Java, etc.

Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Greg Donald
On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
 Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.

You mean how both Ruby and Python list serv traffic is way up while
PHP's is way down?  Even the PHP dev list is really slowed the past
year or so.. just some guy named Richard bothering them about random
stuff every once in a while, that's about it.  Oh, and the occasional
namespace discussion.  To namespace or not to namespace, who really
cares.

But to clarify the obvious for those without their own clue bat with
which to beat one's self, I was referring to language quality with
regard to OO.  PHP is a cluster-fuck in comparison to pretty much
anything out there.. except maybe Perl's OO.  And go look at PHP SPL,
and tell me that's not Java by another name.

PHP is the absolute worst language to do any sort of OO programming in.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Borokov Smith

Yes. Just yes.

regards,

boro

Greg Donald schreef:

On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
  

Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.



You mean how both Ruby and Python list serv traffic is way up while
PHP's is way down?  Even the PHP dev list is really slowed the past
year or so.. just some guy named Richard bothering them about random
stuff every once in a while, that's about it.  Oh, and the occasional
namespace discussion.  To namespace or not to namespace, who really
cares.

But to clarify the obvious for those without their own clue bat with
which to beat one's self, I was referring to language quality with
regard to OO.  PHP is a cluster-fuck in comparison to pretty much
anything out there.. except maybe Perl's OO.  And go look at PHP SPL,
and tell me that's not Java by another name.

PHP is the absolute worst language to do any sort of OO programming in.


  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 15:52 -0500, Greg Donald wrote:
 On 8/7/07, Robert Cummings [EMAIL PROTECTED] wrote:
  Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.
 
 You mean how both Ruby and Python list serv traffic is way up while
 PHP's is way down?

Way up and way down are trends. Trends may be fads or they may be
sustained cultural changes. Time will tell, but it certainly hasn't told
yet. I hardly consider list serv traffic an indicator of language
superiority... especially when high traffic may be an indicator of bugs.

   Even the PHP dev list is really slowed the past
 year or so.. just some guy named Richard bothering them about random
 stuff every once in a while, that's about it.  Oh, and the occasional
 namespace discussion.  To namespace or not to namespace, who really
 cares.

Those who discuss it *lol*.

 But to clarify the obvious for those without their own clue bat with
 which to beat one's self, I was referring to language quality with
 regard to OO.  PHP is a cluster-fuck in comparison to pretty much
 anything out there.. except maybe Perl's OO.  And go look at PHP SPL,
 and tell me that's not Java by another name.

I dunno, I don't use it. Haven't found a need for it yet.

 PHP is the absolute worst language to do any sort of OO programming in.

That's a very subjective statement. I've had no trouble writing OOP
since PHP3. I like references in PHP4, and it's nice that PHP5 uses
automatic references when assigning objects by value. But that's just
cake icing. OOP is a programming style, not necessarily a language
construct.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] javascript in head or in body ?

2007-08-07 Thread Richard Davey
Hi Greg,

Tuesday, August 7, 2007, 9:52:28 PM, you wrote:

 PHP is the absolute worst language to do any sort of OO programming
 in.

Ignoring the digg user mentality of that statement, try ASP if you
want to see OO suck *royally*

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Stut

Richard Davey wrote:

Tuesday, August 7, 2007, 9:52:28 PM, you wrote:


PHP is the absolute worst language to do any sort of OO programming
in.


Ignoring the digg user mentality of that statement, try ASP if you
want to see OO suck *royally*


ASP is not a language, it's most like a framework. I think you meant VB6.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Richard Lynch
On Tue, August 7, 2007 3:19 pm, C.R.Vegelin wrote:
 Are there any rules when to include javascript in head or in body
 ?
 For example,
 script type=text/javascript
 function reload(form)
 {  var
 val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
self.location='QueryForm.php?Chapter=' + val ;
 }
 /script

Yes.

But this is a general HTML/Javascript question, and not a PHP question.

The best short answer I can provide is this:

When in doubt, it belongs in head

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Richard Lynch
On Tue, August 7, 2007 2:48 pm, Tijnema wrote:
 On 8/7/07, Greg Donald [EMAIL PROTECTED] wrote:
 On 8/7/07, Tijnema [EMAIL PROTECTED] wrote:
  Uhh, do you know which list this is?

 I give up..  Is it the one where I get as many [OT] labeled emails
 as
 I do on-topic ones?

 People have been asking basic html questions here for (over?) a
 decade, and it probably won't stop anytime soon.  Newcomers don't
 know
 it's wrong because they haven't seen anyone be smacked down for it.
 So until you can smack someone down in advance, it won't stop.

 What about a php-html list? or php-js? :P

This might drain off some of the not really on topic questions from
newbies who don't understand how the jigsaw puzzle pieces fit
together...

But the number of actual on-topic questions invovling PHP and HTML or
PHP and JS is pretty dang low...

So they'd still be off-topic, just on another list.

And would anybody who knows enough to say they're off-topic even
subscribe?

Or would the lists just sort of wither and die and then we'd just get
the same questions back here again?

PS
As a common courtesy, if you're going to tell somebody they are
off-topic, a recommendation for where it might be on topic or some
indication of what subject matter they ARE talking about would
probably be much more useful than just that's OT!

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php