473,396 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

nesting JS in echo's

hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to no
avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
Nov 8 '08 #1
32 2589
Request-1 <he***@you.comwrote:
hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to no
avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
It will work, but it is probably easier to do a line at a time, as in
these example lines from a PHP page that does JS:

echo "<script LANGUAGE='JavaScript'>\n";

echo "<INPUT type=\"hidden\" name=\"clock\" size=\"3\" value=\"\">\n";
--
Jim Pennino

Remove .spam.sux to reply.
Nov 8 '08 #2
On Nov 7, 6:58*pm, "Request-1" <he...@you.comwrote:
hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to no
avail.

here's the JS CODE i use in the tail end of my PHP. *"picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..

++++++++++++++++

{ echo "

* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }

++++++++++++++++++++++++++

thanks
You can do this:

{ ?>

<!-- No escaping required -->

<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>

<?php }

Is "picnumber" a JavaScript or PHP veriable?

Thomas
Nov 8 '08 #3
On Nov 7, 7:16*pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 7, 6:58*pm, "Request-1" <he...@you.comwrote:
hi folks,
html coder here, new and terrified * of php!!
aaaaaa!
i'm trying to bury a JS script to rotate a photo, in a page i convertedfrom
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
worked fine.
thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in theJS.
i tried escaping the double quotes (my echo used double quotes), but tono
avail.
here's the JS CODE i use in the tail end of my PHP. *"picnumber" is the
variable holding the randomly assigned number that chooses the picture.
any help much appreciated..
++++++++++++++++
{ echo "
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
++++++++++++++++++++++++++
thanks

You can do this:

{ ?>

<!-- No escaping required -->

<script type='text/javascript'>
* * document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>

<?php }

Is "picnumber" a JavaScript or PHP veriable?

Thomas
You can also use "heredoc":
http://us3.php.net/manual/en/languag...syntax.heredoc

<?php
echo <<<DOESNTMATTERWHATTHISSAYS

<!-- No escaping required -->
<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
DOESNTMATTERWHATTHISSAYS;
// Don't indent the above line line

Thomas
Nov 8 '08 #4
On Nov 7, 7:24*pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 7, 7:16*pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 7, 6:58*pm, "Request-1" <he...@you.comwrote:
hi folks,
html coder here, new and terrified * of php!!
aaaaaa!
i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
worked fine.
thought I'd try integrating a tested and true JS image random rotatorscript
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.
i tried escaping the double quotes (my echo used double quotes), but to no
avail.
here's the JS CODE i use in the tail end of my PHP. *"picnumber" isthe
variable holding the randomly assigned number that chooses the picture.
any help much appreciated..
++++++++++++++++
{ echo "
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
++++++++++++++++++++++++++
thanks
You can do this:
{ ?>
<!-- No escaping required -->
<script type='text/javascript'>
* * document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
<?php }
Is "picnumber" a JavaScript or PHP veriable?
Thomas

You can also use "heredoc":http://us3.php.net/manual/en/languag...language.types...

<?php
echo <<<DOESNTMATTERWHATTHISSAYS

<!-- No escaping required -->
<script type='text/javascript'>
* * document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>

DOESNTMATTERWHATTHISSAYS;
// Don't indent the above line line

Thomas
My bad, should have clarified: "DOESNTMATTERWHATTHISSAYS" means just
that, but those two have to match precisely.

Thomas
Nov 8 '08 #5
"703designs" <th**********@gmail.comwrote in message
news:35**********************************@r37g2000 prr.googlegroups.com...
On Nov 7, 7:24 pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 7, 7:16 pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 7, 6:58 pm, "Request-1" <he...@you.comwrote:
hi folks,
html coder here, new and terrified * of php!!
aaaaaa!
i'm trying to bury a JS script to rotate a photo, in a page i
converted from
html to php.
the conversion went well, it was to use a php session cookie to stop
the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie
value
was nil.
worked fine.
thought I'd try integrating a tested and true JS image random rotator
script
into the echo command, but the problem was the syntax of the single
quotes
and double quotes needed in the doc.write and variable sequences in
the JS.
i tried escaping the double quotes (my echo used double quotes), but
to no
avail.
here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the
picture.
any help much appreciated..
++++++++++++++++
{ echo "
<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }
++++++++++++++++++++++++++
thanks
You can do this:
{ ?>
<!-- No escaping required -->
<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
<?php }
Is "picnumber" a JavaScript or PHP veriable?
Thomas

You can also use
"heredoc":http://us3.php.net/manual/en/languag...language.types...

<?php
echo <<<DOESNTMATTERWHATTHISSAYS

<!-- No escaping required -->
<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>

DOESNTMATTERWHATTHISSAYS;
// Don't indent the above line line

Thomas
My bad, should have clarified: "DOESNTMATTERWHATTHISSAYS" means just
that, but those two have to match precisely.

Thomas



thanks guys but no luck.
i'm swimming in single & double-quote-land.
I'll list the segments of PHP code I used below; if anyone can spot the
problem,
please bellow..

thanks ...
(problem seems in the php echo'ing of the JS)
(doc is saved with ".php" extension)


at very top of doc...

<?php setcookie("firsttime","no") ?>

then, the normal doctype, html tags, plus the following scripts to run the
activex for the video ...

<script src="Scripts/AC_RunActiveContent.js"
type="text/javascript"></script>
<script src="Scripts/AC_ActiveX.js"
type="text/javascript"></script>

then, I tried to "php-ize" the JS that sets the random variable ... (in
single lines as suggestd....)

<?php
echo '<script language="javascript">\n';
echo 'var picswap;\n';
echo 'picswap=new Image(320, 240);\n';
echo 'picswap.src="/images/swap/1.jpg"\n';
echo 'var picno = Math.random()*26;\n';
echo 'picno = Math.round(picno)\n';
echo '</script>';
?>
then, end of <headand more <htmlstuff ...
then, the PHP codes the ECHO's the activx/object embed stuff which plays the
movie only if you are 1st-time loading the page...
<?php
$firsttime = $_COOKIE[firsttime];
if (@$firsttime != "no") { echo "
<script type='text/javascript'>
AC_AX_RunContent(
'id','mediaPlayer','width','320','height','280','c lassid','CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95','codebase','http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701','standby','Loadin g
Microsoft Windows Media Player
components...','type','application/x-oleobject','pluginspage','http://microsoft.com/windows/mediaplayer/en/download/','name','mediaPlayer','displaysize','4','autosize ','-1','bgcolor','darkblue','showcontrols','true','sho wtracker','-1','showdisplay','0','showstatusbar','true','video border3d','-1','src','movies/bodymechs.wmv','autostart','true','designtimesp',' 5311','loop','false','filename','movies/bodymechs.wmv','animationatstart','true','transpar entatstart','true'
); //end AC code
</script><noscript><OBJECT id='mediaPlayer' width='320' height='280'
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...'
type='application/x-oleobject'>
<param name='fileName' value='movies/movie01.wmv'><param
name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value='true'>
<param name='showControls' value='true'>
<param name='loop' value='false'>
<param name='ShowStatusBar' value='true'>
<EMBED type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'
bgcolor='darkblue' showcontrols='true' showtracker='-1'
showdisplay='0' showstatusbar='0' videoborder3d='-1' width='320'
height='240'
src='movies/movie01.wmv' autostart='false' designtimesp='5311'
loop='false'>
</EMBED>
</OBJECT></noscript>"; }

then, the IF branch, that sets the condition for followup visits to the
page....
if (@$firsttime != "")
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write(\"'<img src='images/swap/'+
picno + '.jpg'>\");\n";
echo "// end -->\n";
echo "</script>"; }

?>



Nov 8 '08 #6
Request-1 wrote:
hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to no
avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks

You have an extra single quote before <img ...

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 8 '08 #7

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
Request-1 wrote:
>hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to
no avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks

You have an extra single quote before <img ...


Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!
Nov 8 '08 #8
On Nov 7, 9:47*pm, "Request-1" <he...@you.comwrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message

news:gf**********@registered.motzarella.org...
Request-1 wrote:
hi folks,
html coder here, new and terrified * of php!!
aaaaaa!
i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
worked fine.
thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.
i tried escaping the double quotes (my echo used double quotes), but to
no avail.
here's the JS CODE i use in the tail end of my PHP. *"picnumber" is the
variable holding the randomly assigned number that chooses the picture..
any help much appreciated..
++++++++++++++++
{ echo "
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
++++++++++++++++++++++++++
thanks
You have an extra single quote before <img ...

Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). *so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,

{ echo "<script language='JavaScript1.2'>\n";
* * * echo "<!-- begin \n";
* *echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
* *echo "// end *-->\n";
* *echo "</script>"; }

but no avail. *still no pic shows up.

anyway. * i get really confused with all the nested stuff and single-double
quotes. *i may try that "heredoc" thing that Thomas suggested. *I'll need a
couple of beers first. * Friday night on Javascript? *Bad!
Do you have a link to what you're working on?

Also, a note on echoing HTML from PHP: If you need to selectively drop
bits of HTML, this could (just maybe) be a good idea, but usually it's
not. Outputting JavaScript that outputs HTML seems very round-about to
me. Especially because you're adding the image element in such an
obtrusive manner (rather than adding a DOM node and changing its
source programmatically).

Now, on to the functionality itself. As it stands now, you're relying
on JS to provide the randomness. Why do you want to do that if you
have access to PHP? The only reason I've done something like this is
because I was stuck in an HTML-only environment. Actually, I wrote a
script for a coworker today to exactly that because she had ot
implement the same thing in a Dreamweaver template. You can take a
look if you want: http://content.coprinstitute.org/lib...RandomImage.js

The comments are only a tiny bit out of date: I recently extended it
to also affect the image source (it originally was for background
image styles). The cool thing is that you can pass in as many
filenames as you want.

Call the function like this:

randomImage(target image, image folder, method, filename, filename,
filename...);

For example:

randomImage("imageId", "/images", "src", "filename1.jpg",
"filename2.jpg");

would randomly select one of these two images on the page load (if I
made it an onload event).

Thomas

Nov 8 '08 #9
Request-1 wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
>Request-1 wrote:
>>hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to
no avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
You have an extra single quote before <img ...

Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!

Yes, I'm familiar with concatenating and JS. I should have looked more
closely - I just saw the mismatched quotes and took the first one. Your
formatting and the word wrap makes your code harder to read.

So what do you get for js errors? Have you looked at the generated js code?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 8 '08 #10
Request-1 wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
>Request-1 wrote:
>>hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to
no avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
You have an extra single quote before <img ...

Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!

BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 8 '08 #11
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
Request-1 wrote:
>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
>>Request-1 wrote:
hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i
converted from html to php.
the conversion went well, it was to use a php session cookie to
stop the repeating of an embedded video file on a per session
basis; i amended the php code to display a still pic if the session
cookie value was nil.

worked fine.

thought I'd try integrating a tested and true JS image random
rotator script into the echo command, but the problem was the
syntax of the single quotes and double quotes needed in the
doc.write and variable sequences in the JS.

i tried escaping the double quotes (my echo used double quotes),
but to no avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is
the variable holding the randomly assigned number that chooses the
picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber +
'.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
You have an extra single quote before <img ...

Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating"
or something?). so the <img src...statement was broken down into 3
seperate stings to be re-joined - all within the double-quote nested
doc.write stmt. my mistake was to leave the image path in single
quotes; instead I tried "escaped double quotes" to complete the image
path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and
single-double quotes. i may try that "heredoc" thing that Thomas
suggested. I'll need a couple of beers first. Friday night on
Javascript? Bad!


BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.
Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.
Nov 8 '08 #12
On Sat, 08 Nov 2008 02:47:31 GMT, he***@you.com wrote:
>
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
Request-1 wrote:
hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to
no avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
You have an extra single quote before <img ...

Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?).
Actually, you are not concatenating anything with the code Jerry
pointed out:
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
this results in:

document.write("'<img src='images/swap/'+ picnumber + '.jpg'");

This is a single string of invalid HTML. You should have used double
quotes, not single, while also not using the initial single quote:

document.write("<img src='images/swap/" + picnumber + ".jpg'>");

<ot>
You should also note that "document.write" doesn't function when
XHTML is served as application/xhtml+xml. It would also be much
cleaner if you used the DOM in the first place.
</ot>

[snip]
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
Is there any particular reason you have this code in a block, or did
you not post enough code above it?

--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
Nov 8 '08 #13
<ot>
You should also note that "document.write" doesn't function when
XHTML is served as application/xhtml+xml. It would also be much
cleaner if you used the DOM in the first place.
</ot>

[snip]
>>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }

Is there any particular reason you have this code in a block, or did
you not post enough code above it?

--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
thanks to Curtis & 703 ...

ok, finally got it; the PHP "if" fork I used was fine:

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\" width=\"320\" height=\"240\" border=\"0\"
alt=\"Fitness Training\">');\n";
echo "// end -->\n";
echo "</script>"; }

but I made a mistake in "php-izing" the <headrandomizing JS function. it
was fine to leave it in the orig JS.
Works like a charm now. Thanks to all for your input and finnicky
single-quote double-vision.

my original page that plays the intro video at every load is here:
http://bodymechanicsonline.com/home.htm

my experimental page that uses PHP session cookie to limit the video to 1st
load only, is here:
http://bodymechanicsonline.com/home.php

it's a little nerve-wracking but somewhat gratifying (!) to splice a little
PHP into a mostly-html page, call it by a php extension, and see it render
properly even tho' most of the page is not "echo'd" as per "proper" php.

anyway, i'm happy to live on Html Mountain; my brain flounder$ when it see$
too many dollar $igns ...
Nov 8 '08 #14
Request-1 wrote:
>
thanks guys but no luck.
i'm swimming in single & double-quote-land.


I was thinking exactly the same as Thomas on this one. Echoing the stuff out
is only gonna complicate things and slow execution down. No reason you
shouldn't do

<?php
if ($something_or_other) { ?>

<script type="text/javascript>
alert("What's up, baby? <?php echo "I mean, what's up? :)" ?>");
</script>

<?php }
// And on with the show...
?>

Also, make sure you handle your cookies correctly. You can't create a cookie
and read it in the same script run. Also, make sure to specify the domain
and scope (".bodymechanicsonline.com"), or the cookie will exist for
http://bodymechanicsonline.com/ but not
http://www.bodymechanicsonline.com/, and vice versa. The new Firebug has
cookie support, makes it easy to debug.

HTH,
Daniel :)
Nov 8 '08 #15
Request-1 wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
>Request-1 wrote:
>>hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to
no avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..
++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks
You have an extra single quote before <img ...

Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!

The heredoc is probably the best choice (as i'm not really a big fan
of dropping in and out of <?PHP ?for some reason, readability I
guess.) HEREDOC allows variable expansion...
Take a look at: http://us2.php.net/manual/en/language.types.string.php

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Nov 8 '08 #16
On Nov 8, 7:47*am, Norman Peelman <npeel...@cfl.rr.comwrote:
Request-1 wrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
Request-1 wrote:
hi folks,
>html coder here, new and terrified * of php!!
aaaaaa!
>i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>worked fine.
>thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.
>i tried escaping the double quotes (my echo used double quotes), but to
no avail.
>here's the JS CODE i use in the tail end of my PHP. *"picnumber" isthe
variable holding the randomly assigned number that chooses the picture.
>any help much appreciated..
>++++++++++++++++
>{ echo "
>* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
>++++++++++++++++++++++++++
>thanks
You have an extra single quote before <img ...
Hi Jerry,
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). *so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,
{ echo "<script language='JavaScript1.2'>\n";
* * * echo "<!-- begin \n";
* *echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
* *echo "// end *-->\n";
* *echo "</script>"; }
but no avail. *still no pic shows up.
anyway. * i get really confused with all the nested stuff and single-double
quotes. *i may try that "heredoc" thing that Thomas suggested. *I'll need a
couple of beers first. * Friday night on Javascript? *Bad!

* *The heredoc is probably the best choice (as i'm not really a big fan
of dropping in and out of <?PHP ?for some reason, readability I
guess.) HEREDOC allows variable expansion...

Take a look at:http://us2.php.net/manual/en/language.types.string.php

--
Norman
Registered Linux user #461062
-Have you been towww.php.netyet?-
And of course, if you're willing to go a slightly expensive route
(performance-wise), you could always just make these script(s) a
separate file and include them where necessary. I think that's the
cleanest solution as long as you include an HTML comment indicating
where the code is coming from (a habit of mine).

Thomas
Nov 8 '08 #17
Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Request-1 wrote:
>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
Request-1 wrote:
hi folks,
>
html coder here, new and terrified * of php!!
aaaaaa!
>
i'm trying to bury a JS script to rotate a photo, in a page i
converted from html to php.
the conversion went well, it was to use a php session cookie to
stop the repeating of an embedded video file on a per session
basis; i amended the php code to display a still pic if the session
cookie value was nil.
>
worked fine.
>
thought I'd try integrating a tested and true JS image random
rotator script into the echo command, but the problem was the
syntax of the single quotes and double quotes needed in the
doc.write and variable sequences in the JS.
>
i tried escaping the double quotes (my echo used double quotes),
but to no avail.
>
here's the JS CODE i use in the tail end of my PHP. "picnumber" is
the variable holding the randomly assigned number that chooses the
picture.
>
any help much appreciated..
>
>
++++++++++++++++
>
{ echo "
>
<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber +
'.jpg'>\");
// end -->
</script>
"; }
>
++++++++++++++++++++++++++
>
thanks
You have an extra single quote before <img ...
Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating"
or something?). so the <img src...statement was broken down into 3
seperate stings to be re-joined - all within the double-quote nested
doc.write stmt. my mistake was to leave the image path in single
quotes; instead I tried "escaped double quotes" to complete the image
path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and
single-double quotes. i may try that "heredoc" thing that Thomas
suggested. I'll need a couple of beers first. Friday night on
Javascript? Bad!

BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.

Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.

1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.

HTML does NOT require quotes on numeric attributes.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 9 '08 #18
On Nov 8, 7:21*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Seni Seven wrote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
Request-1 wrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
news:gf**********@registered.motzarella.org...
Request-1 wrote:
hi folks,
>>>html coder here, new and terrified * of php!!
aaaaaa!
>>>i'm trying to bury a JS script to rotate a photo, in a page i
converted from html to php.
the conversion went well, it was to use a php session cookie to
stop the repeating of an embedded video file on a per session
basis; i amended the php code to display a still pic if the session
cookie value was nil.
>>>worked fine.
>>>thought I'd try integrating a tested and true JS image random
rotator script into the echo command, but the problem was the
syntax of the single quotes and double quotes needed in the
doc.write and variable sequences in the JS.
>>>i tried escaping the double quotes (my echo used double quotes),
but to no avail.
>>>here's the JS CODE i use in the tail end of my PHP. *"picnumber" is
the variable holding the randomly assigned number that chooses the
picture.
>>>any help much appreciated..
>>>++++++++++++++++
>>>{ echo "
>>>* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber +
* * '.jpg'>\");
* *// end *-->
</script>
* *"; }
>>>++++++++++++++++++++++++++
>>>thanks
You have an extra single quote before <img ...
>Hi Jerry,
>the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating"
or something?). *so the <img src...statement was broken down into3
seperate stings to be re-joined - all within the double-quote nested
doc.write stmt. my mistake was to leave the image path in single
quotes; instead I tried "escaped double quotes" to complete the image
path, like so,
>{ echo "<script language='JavaScript1.2'>\n";
* * * echo "<!-- begin \n";
* *echo "document.write('<img src=\"images/swap/' + picnumber
* *+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
* *echo "// end *-->\n";
* *echo "</script>"; }
>but no avail. *still no pic shows up.
>anyway. * i get really confused with all the nested stuff and
single-double quotes. *i may try that "heredoc" thing that Thomas
suggested. *I'll need a couple of beers first. * Friday night on
Javascript? *Bad!
BTW - you don't need quotes around numeric values like your width,
height and border. *Only non-numeric data.
Are you talking about generating strict (X)HTML? *Quotes must be on all
element attributes in that case, regardless of attribute value type.

1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.

HTML does NOT require quotes on numeric attributes.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Haha, where did you get that from? I've been building sites for ages
now with the XHTML doctype (transitional or strict, validates) and
never had any problems. I don't think I've ever had the desire or a
reason to use single quotes in HTML...

Thomas
Nov 9 '08 #19
703designs wrote:
On Nov 8, 7:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Seni Seven wrote:
>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
Request-1 wrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
news:gf**********@registered.motzarella.org. ..
>Request-1 wrote:
>>hi folks,
>>html coder here, new and terrified * of php!!
>>aaaaaa!
>>i'm trying to bury a JS script to rotate a photo, in a page i
>>converted from html to php.
>>the conversion went well, it was to use a php session cookie to
>>stop the repeating of an embedded video file on a per session
>>basis; i amended the php code to display a still pic if the session
>>cookie value was nil.
>>worked fine.
>>thought I'd try integrating a tested and true JS image random
>>rotator script into the echo command, but the problem was the
>>syntax of the single quotes and double quotes needed in the
>>doc.write and variable sequences in the JS.
>>i tried escaping the double quotes (my echo used double quotes),
>>but to no avail.
>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>the variable holding the randomly assigned number that chooses the
>>picture.
>>any help much appreciated..
>>++++++++++++++++
>>{ echo "
>> <script language='JavaScript1.2'>
>> <!-- begin
>> document.write(\"'<img src='images/swap/'+ picnumber +
>> '.jpg'>\");
>> // end -->
>></script>
>> "; }
>>++++++++++++++++++++++++++
>>thanks
>You have an extra single quote before <img ...
Hi Jerry,
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating"
or something?). so the <img src...statement was broken down into 3
seperate stings to be re-joined - all within the double-quote nested
doc.write stmt. my mistake was to leave the image path in single
quotes; instead I tried "escaped double quotes" to complete the image
path, like so,
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.
anyway. i get really confused with all the nested stuff and
single-double quotes. i may try that "heredoc" thing that Thomas
suggested. I'll need a couple of beers first. Friday night on
Javascript? Bad!
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.
Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.

HTML does NOT require quotes on numeric attributes.
Haha, where did you get that from? I've been building sites for ages
now with the XHTML doctype (transitional or strict, validates) and
never had any problems. I don't think I've ever had the desire or a
reason to use single quotes in HTML...

Thomas
Try google. It's well documented.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 9 '08 #20
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>Request-1 wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org.. .
Request-1 wrote:
>hi folks,
>>
>html coder here, new and terrified * of php!!
>aaaaaa!
>>
>i'm trying to bury a JS script to rotate a photo, in a page i
>converted from html to php.
>the conversion went well, it was to use a php session cookie to
>stop the repeating of an embedded video file on a per session
>basis; i amended the php code to display a still pic if the session
>cookie value was nil.
>>
>worked fine.
>>
>thought I'd try integrating a tested and true JS image random
>rotator script into the echo command, but the problem was the
>syntax of the single quotes and double quotes needed in the
>doc.write and variable sequences in the JS.
>>
>i tried escaping the double quotes (my echo used double quotes),
>but to no avail.
>>
>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>the variable holding the randomly assigned number that chooses the
>picture.
>>
>any help much appreciated..
>>
>>
>++++++++++++++++
>>
>{ echo "
>>
> <script language='JavaScript1.2'>
> <!-- begin
> document.write(\"'<img src='images/swap/'+ picnumber +
> '.jpg'>\");
> // end -->
></script>
> "; }
>>
>++++++++++++++++++++++++++
>>
>thanks
You have an extra single quote before <img ...
Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating"
or something?). so the <img src...statement was broken down into 3
seperate stings to be re-joined - all within the double-quote nested
doc.write stmt. my mistake was to leave the image path in single
quotes; instead I tried "escaped double quotes" to complete the image
path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and
single-double quotes. i may try that "heredoc" thing that Thomas
suggested. I'll need a couple of beers first. Friday night on
Javascript? Bad!
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.

Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.


1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the standards-
setting (they use the term "recommendations" modestly instead of
"standards") in strict XHTML. Go figure.

There are various documents that can be googled that specify solutions wo
using XHTML for broken browsers like Internet Explorer, such as using an
XML stylesheet also to get around problems with showing XHTML in
standards-violating, never-get-it-right HTTP clients like Internet
Explorer. This is not rocket science.
>
HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way whatsoever
that quotes can be omitted for attributes that have numeric values. It
does allow for their omission, but recommends they always be used. There
is no indication about whether this recommendation applies to the various
levels of HTML: strict, transitional, frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes

Here is one individual's take on SCRUPULOUSLY quoting all attribute values
in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected contributer
to the HTML usage newsgroups.
Nov 9 '08 #21
Seni Seven <On************@humanitarian.cawrote in comp.lang.php:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Request-1 wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org. ..
>Request-1 wrote:
>>hi folks,
>>>
>>html coder here, new and terrified * of php!!
>>aaaaaa!
>>>
>>i'm trying to bury a JS script to rotate a photo, in a page i
>>converted from html to php.
>>the conversion went well, it was to use a php session cookie to
>>stop the repeating of an embedded video file on a per session
>>basis; i amended the php code to display a still pic if the
>>session cookie value was nil.
>>>
>>worked fine.
>>>
>>thought I'd try integrating a tested and true JS image random
>>rotator script into the echo command, but the problem was the
>>syntax of the single quotes and double quotes needed in the
>>doc.write and variable sequences in the JS.
>>>
>>i tried escaping the double quotes (my echo used double quotes),
>>but to no avail.
>>>
>>here's the JS CODE i use in the tail end of my PHP. "picnumber"
>>is the variable holding the randomly assigned number that
>>chooses the picture.
>>>
>>any help much appreciated..
>>>
>>>
>>++++++++++++++++
>>>
>>{ echo "
>>>
>> <script language='JavaScript1.2'>
>> <!-- begin
>> document.write(\"'<img src='images/swap/'+ picnumber +
>> '.jpg'>\");
>> // end -->
>></script>
>> "; }
>>>
>>++++++++++++++++++++++++++
>>>
>>thanks
>You have an extra single quote before <img ...
>
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called
"concatenating" or something?). so the <img src...statement was
broken down into 3 seperate stings to be re-joined - all within
the double-quote nested doc.write stmt. my mistake was to leave
the image path in single quotes; instead I tried "escaped double
quotes" to complete the image path, like so,
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
>
>
but no avail. still no pic shows up.
>
anyway. i get really confused with all the nested stuff and
single-double quotes. i may try that "heredoc" thing that Thomas
suggested. I'll need a couple of beers first. Friday night on
Javascript? Bad!
>
>
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.

Are you talking about generating strict (X)HTML? Quotes must be on
all element attributes in that case, regardless of attribute value
type.


1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.

Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the standards-
setting (they use the term "recommendations" modestly instead of
"standards") in strict XHTML. Go figure.
[neglected to give the STRICT XHTML-indicated page]

http://www.w3.org/MarkUp/2004/xhtml-faq
>
There are various documents that can be googled that specify solutions
wo using XHTML for broken browsers like Internet Explorer, such as
using an XML stylesheet also to get around problems with showing XHTML
in standards-violating, never-get-it-right HTTP clients like Internet
Explorer. This is not rocket science.
>>
HTML does NOT require quotes on numeric attributes.

Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have numeric
values. It does allow for their omission, but recommends they always
be used. There is no indication about whether this recommendation
applies to the various levels of HTML: strict, transitional,
frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes

Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.


Nov 9 '08 #22
Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Request-1 wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gf**********@registered.motzarella.org. ..
>Request-1 wrote:
>>hi folks,
>>>
>>html coder here, new and terrified * of php!!
>>aaaaaa!
>>>
>>i'm trying to bury a JS script to rotate a photo, in a page i
>>converted from html to php.
>>the conversion went well, it was to use a php session cookie to
>>stop the repeating of an embedded video file on a per session
>>basis; i amended the php code to display a still pic if the session
>>cookie value was nil.
>>>
>>worked fine.
>>>
>>thought I'd try integrating a tested and true JS image random
>>rotator script into the echo command, but the problem was the
>>syntax of the single quotes and double quotes needed in the
>>doc.write and variable sequences in the JS.
>>>
>>i tried escaping the double quotes (my echo used double quotes),
>>but to no avail.
>>>
>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>the variable holding the randomly assigned number that chooses the
>>picture.
>>>
>>any help much appreciated..
>>>
>>>
>>++++++++++++++++
>>>
>>{ echo "
>>>
>> <script language='JavaScript1.2'>
>> <!-- begin
>> document.write(\"'<img src='images/swap/'+ picnumber +
>> '.jpg'>\");
>> // end -->
>></script>
>> "; }
>>>
>>++++++++++++++++++++++++++
>>>
>>thanks
>You have an extra single quote before <img ...
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating"
or something?). so the <img src...statement was broken down into 3
seperate stings to be re-joined - all within the double-quote nested
doc.write stmt. my mistake was to leave the image path in single
quotes; instead I tried "escaped double quotes" to complete the image
path, like so,
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
>
>
but no avail. still no pic shows up.
>
anyway. i get really confused with all the nested stuff and
single-double quotes. i may try that "heredoc" thing that Thomas
suggested. I'll need a couple of beers first. Friday night on
Javascript? Bad!
>
>
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.
Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.

1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.

Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the standards-
setting (they use the term "recommendations" modestly instead of
"standards") in strict XHTML. Go figure.
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?
There are various documents that can be googled that specify solutions wo
using XHTML for broken browsers like Internet Explorer, such as using an
XML stylesheet also to get around problems with showing XHTML in
standards-violating, never-get-it-right HTTP clients like Internet
Explorer. This is not rocket science.
>HTML does NOT require quotes on numeric attributes.

Actually the HTML 4 recommendation does not assert in any way whatsoever
that quotes can be omitted for attributes that have numeric values. It
does allow for their omission, but recommends they always be used. There
is no indication about whether this recommendation applies to the various
levels of HTML: strict, transitional, frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
Here is one individual's take on SCRUPULOUSLY quoting all attribute values
in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected contributer
to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.

Search enough and you can find an opinion you agree with anywhere on the
internet.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 9 '08 #23
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Request-1 wrote:
>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>news:gf**********@registered.motzarella.org.. .
>>Request-1 wrote:
>>>hi folks,
>>>>
>>>html coder here, new and terrified * of php!!
>>>aaaaaa!
>>>>
>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>converted from html to php.
>>>the conversion went well, it was to use a php session cookie to
>>>stop the repeating of an embedded video file on a per session
>>>basis; i amended the php code to display a still pic if the
>>>session cookie value was nil.
>>>>
>>>worked fine.
>>>>
>>>thought I'd try integrating a tested and true JS image random
>>>rotator script into the echo command, but the problem was the
>>>syntax of the single quotes and double quotes needed in the
>>>doc.write and variable sequences in the JS.
>>>>
>>>i tried escaping the double quotes (my echo used double
>>>quotes), but to no avail.
>>>>
>>>here's the JS CODE i use in the tail end of my PHP.
>>>"picnumber" is the variable holding the randomly assigned
>>>number that chooses the picture.
>>>>
>>>any help much appreciated..
>>>>
>>>>
>>>++++++++++++++++
>>>>
>>>{ echo "
>>>>
>>> <script language='JavaScript1.2'>
>>> <!-- begin
>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>> '.jpg'>\");
>>> // end -->
>>></script>
>>> "; }
>>>>
>>>++++++++++++++++++++++++++
>>>>
>>>thanks
>>You have an extra single quote before <img ...
>>
>Hi Jerry,
>>
>the single quote is actually necessary in JS when you're using
>document.write to add strings in series (is it called
>"concatenating" or something?). so the <img src...statement
>was broken down into 3 seperate stings to be re-joined - all
>within the double-quote nested doc.write stmt. my mistake was to
>leave the image path in single quotes; instead I tried "escaped
>double quotes" to complete the image path, like so,
>>
>{ echo "<script language='JavaScript1.2'>\n";
> echo "<!-- begin \n";
> echo "document.write('<img src=\"images/swap/' + picnumber
> +'.jpg\"
>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>Image\">');\n";
> echo "// end -->\n";
> echo "</script>"; }
>>
>>
>but no avail. still no pic shows up.
>>
>anyway. i get really confused with all the nested stuff and
>single-double quotes. i may try that "heredoc" thing that Thomas
>suggested. I'll need a couple of beers first. Friday night on
>Javascript? Bad!
>>
>>
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.
Are you talking about generating strict (X)HTML? Quotes must be on
all element attributes in that case, regardless of attribute value
type.
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported
by some browser, not the least being IE 6 and 7.

Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the
standards- setting (they use the term "recommendations" modestly
instead of "standards") in strict XHTML. Go figure.

Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?
>There are various documents that can be googled that specify
solutions wo using XHTML for broken browsers like Internet Explorer,
such as using an XML stylesheet also to get around problems with
showing XHTML in standards-violating, never-get-it-right HTTP clients
like Internet Explorer. This is not rocket science.
>>HTML does NOT require quotes on numeric attributes.

Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have
numeric values. It does allow for their omission, but recommends
they always be used. There is no indication about whether this
recommendation applies to the various levels of HTML: strict,
transitional, frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes

Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
>
>Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.

So? That's one person's opinion. Worth no more or less than anyone
else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.

But then you have already established that you are a hair-splitter.

Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
Search enough and you can find an opinion you agree with anywhere on
the internet.
Precisely right!

But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, some of
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.

Oh my!

A new word of the day:

http://www.merriam-webster.com/dictionary/consensus
Nov 9 '08 #24
Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>
>Request-1 wrote:
>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>news:gf**********@registered.motzarella.org. ..
>>>Request-1 wrote:
>>>>hi folks,
>>>>>
>>>>html coder here, new and terrified * of php!!
>>>>aaaaaa!
>>>>>
>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>converted from html to php.
>>>>the conversion went well, it was to use a php session cookie to
>>>>stop the repeating of an embedded video file on a per session
>>>>basis; i amended the php code to display a still pic if the
>>>>session cookie value was nil.
>>>>>
>>>>worked fine.
>>>>>
>>>>thought I'd try integrating a tested and true JS image random
>>>>rotator script into the echo command, but the problem was the
>>>>syntax of the single quotes and double quotes needed in the
>>>>doc.write and variable sequences in the JS.
>>>>>
>>>>i tried escaping the double quotes (my echo used double
>>>>quotes), but to no avail.
>>>>>
>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>"picnumber" is the variable holding the randomly assigned
>>>>number that chooses the picture.
>>>>>
>>>>any help much appreciated..
>>>>>
>>>>>
>>>>++++++++++++++++
>>>>>
>>>>{ echo "
>>>>>
>>>> <script language='JavaScript1.2'>
>>>> <!-- begin
>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>> '.jpg'>\");
>>>> // end -->
>>>></script>
>>>> "; }
>>>>>
>>>>++++++++++++++++++++++++++
>>>>>
>>>>thanks
>>>You have an extra single quote before <img ...
>>Hi Jerry,
>>>
>>the single quote is actually necessary in JS when you're using
>>document.write to add strings in series (is it called
>>"concatenating" or something?). so the <img src...statement
>>was broken down into 3 seperate stings to be re-joined - all
>>within the double-quote nested doc.write stmt. my mistake was to
>>leave the image path in single quotes; instead I tried "escaped
>>double quotes" to complete the image path, like so,
>>>
>>{ echo "<script language='JavaScript1.2'>\n";
>> echo "<!-- begin \n";
>> echo "document.write('<img src=\"images/swap/' + picnumber
>> +'.jpg\"
>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>Image\">');\n";
>> echo "// end -->\n";
>> echo "</script>"; }
>>>
>>>
>>but no avail. still no pic shows up.
>>>
>>anyway. i get really confused with all the nested stuff and
>>single-double quotes. i may try that "heredoc" thing that Thomas
>>suggested. I'll need a couple of beers first. Friday night on
>>Javascript? Bad!
>>>
>>>
>BTW - you don't need quotes around numeric values like your width,
>height and border. Only non-numeric data.
Are you talking about generating strict (X)HTML? Quotes must be on
all element attributes in that case, regardless of attribute value
type.
>
>
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported
by some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the
standards- setting (they use the term "recommendations" modestly
instead of "standards") in strict XHTML. Go figure.
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?
>>There are various documents that can be googled that specify
solutions wo using XHTML for broken browsers like Internet Explorer,
such as using an XML stylesheet also to get around problems with
showing XHTML in standards-violating, never-get-it-right HTTP clients
like Internet Explorer. This is not rocket science.

HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have
numeric values. It does allow for their omission, but recommends
they always be used. There is no indication about whether this
recommendation applies to the various levels of HTML: strict,
transitional, frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.

If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
>>Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.

Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.

But then you have already established that you are a hair-splitter.

Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
>Search enough and you can find an opinion you agree with anywhere on
the internet.

Precisely right!

But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, some of
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.

Oh my!

A new word of the day:

http://www.merriam-webster.com/dictionary/consensus
For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is on
the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."

And tens of thousands of similar pages.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 9 '08 #25
On Nov 9, 6:44*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Seni Seven wrote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>Seni Seven wrote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>>>Request-1 wrote:
>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>>news:gf**********@registered.motzarella.org. ..
>>Request-1 wrote:
>>>hi folks,
>>>>>>>html coder here, new and terrified * of php!!
>>>aaaaaa!
>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>converted from html to php.
>>>the conversion went well, it was to use a php session cookie to
>>>stop the repeating of an embedded video file on a per session
>>>basis; i amended the php code to display a still pic if the
>>>session cookie value was nil.
>>>>>>>worked fine.
>>>>>>>thought I'd try integrating a tested and true JS image random
>>>rotator script into the echo command, but the problem was the
>>>syntax of the single quotes and double quotes needed in the
>>>doc.write and variable sequences in the JS.
>>>>>>>i tried escaping the double quotes (my echo used double
>>>quotes), but to no avail.
>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>"picnumber" is the variable holding the randomly assigned
>>>number that chooses the picture.
>>>>>>>any help much appreciated..
>>>>>>>++++++++++++++++
>>>>>>>{ echo "
>>>>>>>* *<script language='JavaScript1.2'>
>>>* * * * <!-- begin
>>>* * document.write(\"'<img src='images/swap/'+ picnumber +
>>>* * '.jpg'>\");
>>>* *// end *-->
>>></script>
>>>* *"; }
>>>>>>>++++++++++++++++++++++++++
>>>>>>>thanks
>>You have an extra single quote before <img ...
>Hi Jerry,
>>>>>the single quote is actually necessary in JS when you're using
>document.write to add strings in series (is it called
>"concatenating" or something?). *so the <img src...statement
>was broken down into 3 seperate stings to be re-joined - all
>within the double-quote nested doc.write stmt. my mistake was to
>leave the image path in single quotes; instead I tried "escaped
>double quotes" to complete the image path, like so,
>>>>>{ echo "<script language='JavaScript1.2'>\n";
>* * * echo "<!-- begin \n";
>* *echo "document.write('<img src=\"images/swap/' + picnumber
>* *+'.jpg\"
>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>Image\">');\n";
>* *echo "// end *-->\n";
>* *echo "</script>"; }
>>>>>but no avail. *still no pic shows up.
>>>>>anyway. * i get really confused with all the nested stuff and
>single-double quotes. *i may try that "heredoc" thing that Thomas
>suggested. *I'll need a couple of beers first. * Friday nighton
>Javascript? *Bad!
>>>>BTW - you don't need quotes around numeric values like your width,
height and border. *Only non-numeric data.
Are you talking about generating strict (X)HTML? *Quotes must be on
all element attributes in that case, regardless of attribute value
type.
>>1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported
by some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages. *
>I looked at this page successfully using IE7. *The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the
standards- setting (they use the term "recommendations" modestly
instead of "standards") in strict XHTML. *Go figure. *
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? *Where is the need for xhtml?
>There are various documents that can be googled that specify
solutions wo using XHTML for broken browsers like Internet Explorer,
such as using an XML stylesheet also to get around problems with
showing XHTML in standards-violating, never-get-it-right HTTP clients
like Internet Explorer. *This is not rocket science.
>>HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have
numeric values. *It does allow for their omission, but recommends
they always be used. *There is no indication about whether this
recommendation applies to the various levels of HTML: *strict,
transitional, frameset.
>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
>Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:
>>http://www.cs.tut.fi/~jkorpela/qattr.html
>He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.
So? *That's one person's opinion. *Worth no more or less than anyone
else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.
But then you have already established that you are a hair-splitter.
Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
Search enough and you can find an opinion you agree with anywhere on
the internet.
Precisely right!
But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, someof
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.
Oh my!
A new word of the day: *
* *http://www.merriam-webster.com/dictionary/consensus

For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is on
the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."

And tens of thousands of similar pages.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
You may be technically right, but I think that you're practically
wrong. By that, I mean that I don't think anyone writes HTML
differently from XHTML. So we have the illusion that IE works with
XHTML. I'm not sure what is meant by "compatibility principles"
though.

Thomas
Nov 10 '08 #26
703designs wrote:
On Nov 9, 6:44 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Seni Seven wrote:
>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>>Request-1 wrote:
>>>>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>>>>news:gf**********@registered.motzarella.or g...
>>>>>Request-1 wrote:
>>>>>>hi folks,
>>>>>>html coder here, new and terrified * of php!!
>>>>>>aaaaaa!
>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>converted from html to php.
>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>basis; i amended the php code to display a still pic if the
>>>>>>session cookie value was nil.
>>>>>>worked fine.
>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>rotator script into the echo command, but the problem was the
>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>doc.write and variable sequences in the JS.
>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>quotes), but to no avail.
>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>number that chooses the picture.
>>>>>>any help much appreciated..
>>>>>>++++++++++++++++
>>>>>>{ echo "
>>>>>> <script language='JavaScript1.2'>
>>>>>> <!-- begin
>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>> '.jpg'>\");
>>>>>> // end -->
>>>>>></script>
>>>>>> "; }
>>>>>>++++++++++++++++++++++++++
>>>>>>thanks
>>>>>You have an extra single quote before <img ...
>>>>Hi Jerry,
>>>>the single quote is actually necessary in JS when you're using
>>>>document.write to add strings in series (is it called
>>>>"concatenating" or something?). so the <img src...statement
>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>within the double-quote nested doc.write stmt. my mistake was to
>>>>leave the image path in single quotes; instead I tried "escaped
>>>>double quotes" to complete the image path, like so,
>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>> echo "<!-- begin \n";
>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>> +'.jpg\"
>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>Image\">');\n";
>>>> echo "// end -->\n";
>>>> echo "</script>"; }
>>>>but no avail. still no pic shows up.
>>>>anyway. i get really confused with all the nested stuff and
>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>Javascript? Bad!
>>>BTW - you don't need quotes around numeric values like your width,
>>>height and border. Only non-numeric data.
>>Are you talking about generating strict (X)HTML? Quotes must be on
>>all element attributes in that case, regardless of attribute value
>>type.
>1. There is no indication this is XHTML.
>2. You shouldn't use XHTML for web pages - it's not well supported
>by some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages.
I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the
standards- setting (they use the term "recommendations" modestly
instead of "standards") in strict XHTML. Go figure.
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?
There are various documents that can be googled that specify
solutions wo using XHTML for broken browsers like Internet Explorer,
such as using an XML stylesheet also to get around problems with
showing XHTML in standards-violating, never-get-it-right HTTP clients
like Internet Explorer. This is not rocket science.
>HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have
numeric values. It does allow for their omission, but recommends
they always be used. There is no indication about whether this
recommendation applies to the various levels of HTML: strict,
transitional, frameset.
http://www.w3.org/TR/html4/intro/sgm...tml#attributes
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:
http://www.cs.tut.fi/~jkorpela/qattr.html
He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.
But then you have already established that you are a hair-splitter.
Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
Search enough and you can find an opinion you agree with anywhere on
the internet.
Precisely right!
But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, some of
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.
Oh my!
A new word of the day:
http://www.merriam-webster.com/dictionary/consensus
For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is on
the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."

And tens of thousands of similar pages.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

You may be technically right, but I think that you're practically
wrong. By that, I mean that I don't think anyone writes HTML
differently from XHTML. So we have the illusion that IE works with
XHTML. I'm not sure what is meant by "compatibility principles"
though.

Thomas
If you're "technically right", then you can't be "practically wrong".
If they're writing XHTML, it's not supported. If they're writing HTML,
they shouldn't be calling it XHTML.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 10 '08 #27
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>
>>Request-1 wrote:
>>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>>news:gf**********@registered.motzarella.org ...
>>>>Request-1 wrote:
>>>>>hi folks,
>>>>>>
>>>>>html coder here, new and terrified * of php!!
>>>>>aaaaaa!
>>>>>>
>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>converted from html to php.
>>>>>the conversion went well, it was to use a php session cookie
>>>>>to stop the repeating of an embedded video file on a per
>>>>>session basis; i amended the php code to display a still pic
>>>>>if the session cookie value was nil.
>>>>>>
>>>>>worked fine.
>>>>>>
>>>>>thought I'd try integrating a tested and true JS image random
>>>>>rotator script into the echo command, but the problem was the
>>>>>syntax of the single quotes and double quotes needed in the
>>>>>doc.write and variable sequences in the JS.
>>>>>>
>>>>>i tried escaping the double quotes (my echo used double
>>>>>quotes), but to no avail.
>>>>>>
>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>number that chooses the picture.
>>>>>>
>>>>>any help much appreciated..
>>>>>>
>>>>>>
>>>>>++++++++++++++++
>>>>>>
>>>>>{ echo "
>>>>>>
>>>>> <script language='JavaScript1.2'>
>>>>> <!-- begin
>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>> '.jpg'>\");
>>>>> // end -->
>>>>></script>
>>>>> "; }
>>>>>>
>>>>>++++++++++++++++++++++++++
>>>>>>
>>>>>thanks
>>>>You have an extra single quote before <img ...
>>>Hi Jerry,
>>>>
>>>the single quote is actually necessary in JS when you're using
>>>document.write to add strings in series (is it called
>>>"concatenating" or something?). so the <img src...statement
>>>was broken down into 3 seperate stings to be re-joined - all
>>>within the double-quote nested doc.write stmt. my mistake was
>>>to leave the image path in single quotes; instead I tried
>>>"escaped double quotes" to complete the image path, like so,
>>>>
>>>{ echo "<script language='JavaScript1.2'>\n";
>>> echo "<!-- begin \n";
>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>> +'.jpg\"
>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>Training Image\">');\n";
>>> echo "// end -->\n";
>>> echo "</script>"; }
>>>>
>>>>
>>>but no avail. still no pic shows up.
>>>>
>>>anyway. i get really confused with all the nested stuff and
>>>single-double quotes. i may try that "heredoc" thing that
>>>Thomas suggested. I'll need a couple of beers first. Friday
>>>night on Javascript? Bad!
>>>>
>>>>
>>BTW - you don't need quotes around numeric values like your
>>width, height and border. Only non-numeric data.
>Are you talking about generating strict (X)HTML? Quotes must be
>on all element attributes in that case, regardless of attribute
>value type.
>>
>>
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported
by some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the
standards- setting (they use the term "recommendations" modestly
instead of "standards") in strict XHTML. Go figure.

Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?

There are various documents that can be googled that specify
solutions wo using XHTML for broken browsers like Internet
Explorer, such as using an XML stylesheet also to get around
problems with showing XHTML in standards-violating,
never-get-it-right HTTP clients like Internet Explorer. This is
not rocket science.

HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have
numeric values. It does allow for their omission, but recommends
they always be used. There is no indication about whether this
recommendation applies to the various levels of HTML: strict,
transitional, frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes

Which backs up my claim that HTML does NOT require quotes on numeric
attributes.

If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
>>>Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.

Actually, the HTML standards keepers RECOMMEND (though they don't
REQUIRE) you to quote attribute values----ALL OF THEM.

But then you have already established that you are a hair-splitter.

Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
>>Search enough and you can find an opinion you agree with anywhere on
the internet.

Precisely right!

But then I am not so desperate to support my claims on the sole
"opinion" of one kook with a web page against the 99,999 opinions of
people who impress me with reason and logic and a certain level of
erudition, some of whom actually sit on standards-setting committees
like the one that promulgates the HTML specification.

Oh my!

A new word of the day:

http://www.merriam-webster.com/dictionary/consensus

For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is
on the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."

And tens of thousands of similar pages.
What part of that XHTML page that I gave in the response (inserted here
for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did not conform
to the XHTML specification???

Tricking broken browsers---in HTTP response headers, in meta elements,
etc.----that don't comply with either the HTML or XHTML specification---
notwithstanding your hilarious citation of a Wikipedia article whose
content is known to be notoriously inaccurate---is not the fault of page
developers. Perhaps instead of recommending that page developers shy away
from using XHTML in STARK CONTRAST to the HTML specification writers
URGING you to do so, you should be telling them to include alternately
served documents with the simple statement urging their readers to stop
using broken browsers. Many developers do JUST that, just as many
developers that serve script-dependent content tell their readers that the
scientific/chemistry calculator they want to use won't work unless they
enable their browser to use scripts.

And in finishing:

Best practices are that attribute values in HTML---all of them---are
quoted, as RECOMMENDED by those who promulgated the HTML specificiation.
To insist on deviating from best practices is altogether foolish.
Nov 11 '08 #28
Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>
>>>Request-1 wrote:
>>>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>>>news:gf**********@registered.motzarella.or g...
>>>>>Request-1 wrote:
>>>>>>hi folks,
>>>>>>>
>>>>>>html coder here, new and terrified * of php!!
>>>>>>aaaaaa!
>>>>>>>
>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>converted from html to php.
>>>>>>the conversion went well, it was to use a php session cookie
>>>>>>to stop the repeating of an embedded video file on a per
>>>>>>session basis; i amended the php code to display a still pic
>>>>>>if the session cookie value was nil.
>>>>>>>
>>>>>>worked fine.
>>>>>>>
>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>rotator script into the echo command, but the problem was the
>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>doc.write and variable sequences in the JS.
>>>>>>>
>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>quotes), but to no avail.
>>>>>>>
>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>number that chooses the picture.
>>>>>>>
>>>>>>any help much appreciated..
>>>>>>>
>>>>>>>
>>>>>>++++++++++++++++
>>>>>>>
>>>>>>{ echo "
>>>>>>>
>>>>>> <script language='JavaScript1.2'>
>>>>>> <!-- begin
>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>> '.jpg'>\");
>>>>>> // end -->
>>>>>></script>
>>>>>> "; }
>>>>>>>
>>>>>>++++++++++++++++++++++++++
>>>>>>>
>>>>>>thanks
>>>>>You have an extra single quote before <img ...
>>>>Hi Jerry,
>>>>>
>>>>the single quote is actually necessary in JS when you're using
>>>>document.write to add strings in series (is it called
>>>>"concatenating" or something?). so the <img src...statement
>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>within the double-quote nested doc.write stmt. my mistake was
>>>>to leave the image path in single quotes; instead I tried
>>>>"escaped double quotes" to complete the image path, like so,
>>>>>
>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>> echo "<!-- begin \n";
>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>> +'.jpg\"
>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>Training Image\">');\n";
>>>> echo "// end -->\n";
>>>> echo "</script>"; }
>>>>>
>>>>>
>>>>but no avail. still no pic shows up.
>>>>>
>>>>anyway. i get really confused with all the nested stuff and
>>>>single-double quotes. i may try that "heredoc" thing that
>>>>Thomas suggested. I'll need a couple of beers first. Friday
>>>>night on Javascript? Bad!
>>>>>
>>>>>
>>>BTW - you don't need quotes around numeric values like your
>>>width, height and border. Only non-numeric data.
>>Are you talking about generating strict (X)HTML? Quotes must be
>>on all element attributes in that case, regardless of attribute
>>value type.
>>>
>>>
>1. There is no indication this is XHTML.
>2. You shouldn't use XHTML for web pages - it's not well supported
>by some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages.
>
I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the
standards- setting (they use the term "recommendations" modestly
instead of "standards") in strict XHTML. Go figure.
>
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?

There are various documents that can be googled that specify
solutions wo using XHTML for broken browsers like Internet
Explorer, such as using an XML stylesheet also to get around
problems with showing XHTML in standards-violating,
never-get-it-right HTTP clients like Internet Explorer. This is
not rocket science.
>
>HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have
numeric values. It does allow for their omission, but recommends
they always be used. There is no indication about whether this
recommendation applies to the various levels of HTML: strict,
transitional, frameset.
>
http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.

Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:
>
http://www.cs.tut.fi/~jkorpela/qattr.html
>
He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't
REQUIRE) you to quote attribute values----ALL OF THEM.

But then you have already established that you are a hair-splitter.

Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?

Search enough and you can find an opinion you agree with anywhere on
the internet.
Precisely right!

But then I am not so desperate to support my claims on the sole
"opinion" of one kook with a web page against the 99,999 opinions of
people who impress me with reason and logic and a certain level of
erudition, some of whom actually sit on standards-setting committees
like the one that promulgates the HTML specification.

Oh my!

A new word of the day:

http://www.merriam-webster.com/dictionary/consensus
For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is
on the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."

And tens of thousands of similar pages.

What part of that XHTML page that I gave in the response (inserted here
for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did not conform
to the XHTML specification???

Tricking broken browsers---in HTTP response headers, in meta elements,
etc.----that don't comply with either the HTML or XHTML specification---
notwithstanding your hilarious citation of a Wikipedia article whose
content is known to be notoriously inaccurate---is not the fault of page
developers. Perhaps instead of recommending that page developers shy away
from using XHTML in STARK CONTRAST to the HTML specification writers
URGING you to do so, you should be telling them to include alternately
served documents with the simple statement urging their readers to stop
using broken browsers. Many developers do JUST that, just as many
developers that serve script-dependent content tell their readers that the
scientific/chemistry calculator they want to use won't work unless they
enable their browser to use scripts.

And in finishing:

Best practices are that attribute values in HTML---all of them---are
quoted, as RECOMMENDED by those who promulgated the HTML specificiation.
To insist on deviating from best practices is altogether foolish.
If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail to
do that, that's your problem.

But you also haven't identified exactly WHAT is inaccurate about this
article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?

And I didn't say whether something was recommended or not. I said that
quotes were not REQUIRED around numeric values. And they are not.

Pages validate quite well with W3C's only HTML validator when numbers
are not in quotes. It doesn't even give a warning.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 11 '08 #29
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>
>>Seni Seven wrote:
>>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>>
>>>>Request-1 wrote:
>>>>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>>>>news:gf**********@registered.motzarella.o rg...
>>>>>>Request-1 wrote:
>>>>>>>hi folks,
>>>>>>>>
>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>aaaaaa!
>>>>>>>>
>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page
>>>>>>>i converted from html to php.
>>>>>>>the conversion went well, it was to use a php session
>>>>>>>cookie to stop the repeating of an embedded video file on a
>>>>>>>per session basis; i amended the php code to display a
>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>
>>>>>>>worked fine.
>>>>>>>>
>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>random rotator script into the echo command, but the
>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>the JS.
>>>>>>>>
>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>quotes), but to no avail.
>>>>>>>>
>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>number that chooses the picture.
>>>>>>>>
>>>>>>>any help much appreciated..
>>>>>>>>
>>>>>>>>
>>>>>>>++++++++++++++++
>>>>>>>>
>>>>>>>{ echo "
>>>>>>>>
>>>>>>> <script language='JavaScript1.2'>
>>>>>>> <!-- begin
>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>> '.jpg'>\");
>>>>>>> // end -->
>>>>>>></script>
>>>>>>> "; }
>>>>>>>>
>>>>>>>++++++++++++++++++++++++++
>>>>>>>>
>>>>>>>thanks
>>>>>>You have an extra single quote before <img ...
>>>>>Hi Jerry,
>>>>>>
>>>>>the single quote is actually necessary in JS when you're
>>>>>using document.write to add strings in series (is it called
>>>>>"concatenating" or something?). so the <img src...>
>>>>>statement was broken down into 3 seperate stings to be
>>>>>re-joined - all within the double-quote nested doc.write
>>>>>stmt. my mistake was to leave the image path in single
>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>the image path, like so,
>>>>>>
>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>> echo "<!-- begin \n";
>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>> +'.jpg\"
>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>Training Image\">');\n";
>>>>> echo "// end -->\n";
>>>>> echo "</script>"; }
>>>>>>
>>>>>>
>>>>>but no avail. still no pic shows up.
>>>>>>
>>>>>anyway. i get really confused with all the nested stuff and
>>>>>single-double quotes. i may try that "heredoc" thing that
>>>>>Thomas suggested. I'll need a couple of beers first.
>>>>>Friday night on Javascript? Bad!
>>>>>>
>>>>>>
>>>>BTW - you don't need quotes around numeric values like your
>>>>width, height and border. Only non-numeric data.
>>>Are you talking about generating strict (X)HTML? Quotes must
>>>be on all element attributes in that case, regardless of
>>>attribute value type.
>>>>
>>>>
>>1. There is no indication this is XHTML.
>>2. You shouldn't use XHTML for web pages - it's not well
>>supported by some browser, not the least being IE 6 and 7.
>Actually, many can and do use XHTML for web pages.
>>
>I looked at this page successfully using IE7. The web document
>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>standards- setting (they use the term "recommendations" modestly
>instead of "standards") in strict XHTML. Go figure.
>>
Sure, you CAN make pages which will cater to the different
browsers idiosyncrasies, but why? Where is the need for xhtml?
>
>There are various documents that can be googled that specify
>solutions wo using XHTML for broken browsers like Internet
>Explorer, such as using an XML stylesheet also to get around
>problems with showing XHTML in standards-violating,
>never-get-it-right HTTP clients like Internet Explorer. This is
>not rocket science.
>>
>>HTML does NOT require quotes on numeric attributes.
>Actually the HTML 4 recommendation does not assert in any way
>whatsoever that quotes can be omitted for attributes that have
>numeric values. It does allow for their omission, but recommends
>they always be used. There is no indication about whether this
>recommendation applies to the various levels of HTML: strict,
>transitional, frameset.
>>
>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>
Which backs up my claim that HTML does NOT require quotes on
numeric attributes.
If you really want to split hairs, as you apparently want to do,
the loosest usage of HTML doesn't require quotes on any attribute
values except in the very few circumstances that your determined
attempts to confuse the browser do not achieve the rendering you
desire.

>Here is one individual's take on SCRUPULOUSLY quoting all
>attribute values in HTML, which MUST be quoted in every case in
>XHTML:
>>
>http://www.cs.tut.fi/~jkorpela/qattr.html
>>
>He is or was a regular (long-time) and, I believe, respected
>contributer to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than
anyone else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't
REQUIRE) you to quote attribute values----ALL OF THEM.

But then you have already established that you are a hair-splitter.

Perhaps you'd like to disparage the "opinions" of the HTML
standards keepers too?

Search enough and you can find an opinion you agree with anywhere
on the internet.
Precisely right!

But then I am not so desperate to support my claims on the sole
"opinion" of one kook with a web page against the 99,999 opinions
of people who impress me with reason and logic and a certain level
of erudition, some of whom actually sit on standards-setting
committees like the one that promulgates the HTML specification.

Oh my!

A new word of the day:

http://www.merriam-webster.com/dictionary/consensus
For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
1.0 and DOM Level 1, with minor implementation gaps. It partially
supports CSS Level 2 and DOM Level 2, with major implementation gaps
and conformance issues. Full conformance to the CSS 2.1
specification is on the agenda for the final Internet Explorer 8
release.[32] It has no support for XHTML, though it can render XHTML
documents authored with HTML compatibility principles and served
with a text/html MIME-type."

And tens of thousands of similar pages.

What part of that XHTML page that I gave in the response (inserted
here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
not conform to the XHTML specification???

Tricking broken browsers---in HTTP response headers, in meta
elements, etc.----that don't comply with either the HTML or XHTML
specification--- notwithstanding your hilarious citation of a
Wikipedia article whose content is known to be notoriously
inaccurate---is not the fault of page developers. Perhaps instead of
recommending that page developers shy away from using XHTML in STARK
CONTRAST to the HTML specification writers URGING you to do so, you
should be telling them to include alternately served documents with
the simple statement urging their readers to stop using broken
browsers. Many developers do JUST that, just as many developers that
serve script-dependent content tell their readers that the
scientific/chemistry calculator they want to use won't work unless
they enable their browser to use scripts.

And in finishing:

Best practices are that attribute values in HTML---all of them---are
quoted, as RECOMMENDED by those who promulgated the HTML
specificiation. To insist on deviating from best practices is
altogether foolish.

If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail to
do that, that's your problem.

But you also haven't identified exactly WHAT is inaccurate about this
article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?

And I didn't say whether something was recommended or not. I said
that quotes were not REQUIRED around numeric values. And they are
not.

Pages validate quite well with W3C's only HTML validator when numbers
are not in quotes. It doesn't even give a warning.
Yeah, Transitional HTML is forgiving that way.

Set the validator for Strict HTML, and pretty much all of the attributes
you would want to use with numeric values are disallowed---that is,
generate an error on the validator. You are supposed to be using a
styling convention (CSS).

Set the validator to use the HTML Tidy option to----in its words---CLEAN
UP your HTML, and lo and behold, all your unquoted attribute values---
every one of them---get quoted, and your doctype is set to Transitional to
allow the otherwise disallowed attributes in Strict HTML.

What do you think that W3 is saying to the HTML page writer when it
"cleans up" the page this way?

Nov 11 '08 #30
Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>
>>>Seni Seven wrote:
>>>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>>>
>>>>>Request-1 wrote:
>>>>>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>>>>>news:gf**********@registered.motzarella. org...
>>>>>>>Request-1 wrote:
>>>>>>>>hi folks,
>>>>>>>>>
>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>aaaaaa!
>>>>>>>>>
>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page
>>>>>>>>i converted from html to php.
>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>cookie to stop the repeating of an embedded video file on a
>>>>>>>>per session basis; i amended the php code to display a
>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>
>>>>>>>>worked fine.
>>>>>>>>>
>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>the JS.
>>>>>>>>>
>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>quotes), but to no avail.
>>>>>>>>>
>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>number that chooses the picture.
>>>>>>>>>
>>>>>>>>any help much appreciated..
>>>>>>>>>
>>>>>>>>>
>>>>>>>>++++++++++++++++
>>>>>>>>>
>>>>>>>>{ echo "
>>>>>>>>>
>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>> <!-- begin
>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>> '.jpg'>\");
>>>>>>>> // end -->
>>>>>>>></script>
>>>>>>>> "; }
>>>>>>>>>
>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>
>>>>>>>>thanks
>>>>>>>You have an extra single quote before <img ...
>>>>>>Hi Jerry,
>>>>>>>
>>>>>>the single quote is actually necessary in JS when you're
>>>>>>using document.write to add strings in series (is it called
>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>the image path, like so,
>>>>>>>
>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>> echo "<!-- begin \n";
>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>> +'.jpg\"
>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>Training Image\">');\n";
>>>>>> echo "// end -->\n";
>>>>>> echo "</script>"; }
>>>>>>>
>>>>>>>
>>>>>>but no avail. still no pic shows up.
>>>>>>>
>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>single-double quotes. i may try that "heredoc" thing that
>>>>>>Thomas suggested. I'll need a couple of beers first.
>>>>>>Friday night on Javascript? Bad!
>>>>>>>
>>>>>>>
>>>>>BTW - you don't need quotes around numeric values like your
>>>>>width, height and border. Only non-numeric data.
>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>be on all element attributes in that case, regardless of
>>>>attribute value type.
>>>>>
>>>>>
>>>1. There is no indication this is XHTML.
>>>2. You shouldn't use XHTML for web pages - it's not well
>>>supported by some browser, not the least being IE 6 and 7.
>>Actually, many can and do use XHTML for web pages.
>>>
>>I looked at this page successfully using IE7. The web document
>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>standards- setting (they use the term "recommendations" modestly
>>instead of "standards") in strict XHTML. Go figure.
>>>
>Sure, you CAN make pages which will cater to the different
>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>
>>There are various documents that can be googled that specify
>>solutions wo using XHTML for broken browsers like Internet
>>Explorer, such as using an XML stylesheet also to get around
>>problems with showing XHTML in standards-violating,
>>never-get-it-right HTTP clients like Internet Explorer. This is
>>not rocket science.
>>>
>>>HTML does NOT require quotes on numeric attributes.
>>Actually the HTML 4 recommendation does not assert in any way
>>whatsoever that quotes can be omitted for attributes that have
>>numeric values. It does allow for their omission, but recommends
>>they always be used. There is no indication about whether this
>>recommendation applies to the various levels of HTML: strict,
>>transitional, frameset.
>>>
>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>
>Which backs up my claim that HTML does NOT require quotes on
>numeric attributes.
If you really want to split hairs, as you apparently want to do,
the loosest usage of HTML doesn't require quotes on any attribute
values except in the very few circumstances that your determined
attempts to confuse the browser do not achieve the rendering you
desire.
>
>>Here is one individual's take on SCRUPULOUSLY quoting all
>>attribute values in HTML, which MUST be quoted in every case in
>>XHTML:
>>>
>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>
>>He is or was a regular (long-time) and, I believe, respected
>>contributer to the HTML usage newsgroups.
>So? That's one person's opinion. Worth no more or less than
>anyone else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't
REQUIRE) you to quote attribute values----ALL OF THEM.
>
But then you have already established that you are a hair-splitter.
>
Perhaps you'd like to disparage the "opinions" of the HTML
standards keepers too?
>
>Search enough and you can find an opinion you agree with anywhere
>on the internet.
Precisely right!
>
But then I am not so desperate to support my claims on the sole
"opinion" of one kook with a web page against the 99,999 opinions
of people who impress me with reason and logic and a certain level
of erudition, some of whom actually sit on standards-setting
committees like the one that promulgates the HTML specification.
>
Oh my!
>
A new word of the day:
>
http://www.merriam-webster.com/dictionary/consensus
For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
1.0 and DOM Level 1, with minor implementation gaps. It partially
supports CSS Level 2 and DOM Level 2, with major implementation gaps
and conformance issues. Full conformance to the CSS 2.1
specification is on the agenda for the final Internet Explorer 8
release.[32] It has no support for XHTML, though it can render XHTML
documents authored with HTML compatibility principles and served
with a text/html MIME-type."

And tens of thousands of similar pages.
What part of that XHTML page that I gave in the response (inserted
here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
not conform to the XHTML specification???

Tricking broken browsers---in HTTP response headers, in meta
elements, etc.----that don't comply with either the HTML or XHTML
specification--- notwithstanding your hilarious citation of a
Wikipedia article whose content is known to be notoriously
inaccurate---is not the fault of page developers. Perhaps instead of
recommending that page developers shy away from using XHTML in STARK
CONTRAST to the HTML specification writers URGING you to do so, you
should be telling them to include alternately served documents with
the simple statement urging their readers to stop using broken
browsers. Many developers do JUST that, just as many developers that
serve script-dependent content tell their readers that the
scientific/chemistry calculator they want to use won't work unless
they enable their browser to use scripts.

And in finishing:

Best practices are that attribute values in HTML---all of them---are
quoted, as RECOMMENDED by those who promulgated the HTML
specificiation. To insist on deviating from best practices is
altogether foolish.
If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail to
do that, that's your problem.

But you also haven't identified exactly WHAT is inaccurate about this
article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?

And I didn't say whether something was recommended or not. I said
that quotes were not REQUIRED around numeric values. And they are
not.

Pages validate quite well with W3C's only HTML validator when numbers
are not in quotes. It doesn't even give a warning.

Yeah, Transitional HTML is forgiving that way.

Set the validator for Strict HTML, and pretty much all of the attributes
you would want to use with numeric values are disallowed---that is,
generate an error on the validator. You are supposed to be using a
styling convention (CSS).
Like "width" and "height" in <imgtags?
Set the validator to use the HTML Tidy option to----in its words---CLEAN
UP your HTML, and lo and behold, all your unquoted attribute values---
every one of them---get quoted, and your doctype is set to Transitional to
allow the otherwise disallowed attributes in Strict HTML.

What do you think that W3 is saying to the HTML page writer when it
"cleans up" the page this way?
I said nothing about transitional HTML. The same is true for strict HTML.

This has NOTHING to do with whether the attributes are allowed or not
(in fact, all of the ones I use ARE valid - because I only write strict
HTML). And CSS is not for everything.

Sure, it the Tidy option adds quotes. But that does not mean they are
required. They are not - as you have said yourself.

As to what it does when it "cleans up the page" - that's its option.
But either way is still valid - as you have said yourself, quotes are a
recommendation - not a requirement. They are only required on
non-numeric values.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 11 '08 #31
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>
>>Seni Seven wrote:
>>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>>
>>>>Seni Seven wrote:
>>>>>Jerry Stuckle <js*******@attglobal.netwrote in
>>>>>comp.lang.php:
>>>>>>
>>>>>>Request-1 wrote:
>>>>>>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>>>>>>news:gf**********@registered.motzarella .org...
>>>>>>>>Request-1 wrote:
>>>>>>>>>hi folks,
>>>>>>>>>>
>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>aaaaaa!
>>>>>>>>>>
>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a
>>>>>>>>>page i converted from html to php.
>>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>>cookie to stop the repeating of an embedded video file on
>>>>>>>>>a per session basis; i amended the php code to display a
>>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>>
>>>>>>>>>worked fine.
>>>>>>>>>>
>>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>>the JS.
>>>>>>>>>>
>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>
>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>number that chooses the picture.
>>>>>>>>>>
>>>>>>>>>any help much appreciated..
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>++++++++++++++++
>>>>>>>>>>
>>>>>>>>>{ echo "
>>>>>>>>>>
>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>> <!-- begin
>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber
>>>>>>>>> + '.jpg'>\");
>>>>>>>>> // end -->
>>>>>>>>></script>
>>>>>>>>> "; }
>>>>>>>>>>
>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>
>>>>>>>>>thanks
>>>>>>>>You have an extra single quote before <img ...
>>>>>>>Hi Jerry,
>>>>>>>>
>>>>>>>the single quote is actually necessary in JS when you're
>>>>>>>using document.write to add strings in series (is it called
>>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>>the image path, like so,
>>>>>>>>
>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>> echo "<!-- begin \n";
>>>>>>> echo "document.write('<img src=\"images/swap/' +
>>>>>>> picnumber +'.jpg\"
>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>Training Image\">');\n";
>>>>>>> echo "// end -->\n";
>>>>>>> echo "</script>"; }
>>>>>>>>
>>>>>>>>
>>>>>>>but no avail. still no pic shows up.
>>>>>>>>
>>>>>>>anyway. i get really confused with all the nested stuff
>>>>>>>and single-double quotes. i may try that "heredoc" thing
>>>>>>>that Thomas suggested. I'll need a couple of beers first.
>>>>>>>Friday night on Javascript? Bad!
>>>>>>>>
>>>>>>>>
>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>width, height and border. Only non-numeric data.
>>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>>be on all element attributes in that case, regardless of
>>>>>attribute value type.
>>>>>>
>>>>>>
>>>>1. There is no indication this is XHTML.
>>>>2. You shouldn't use XHTML for web pages - it's not well
>>>>supported by some browser, not the least being IE 6 and 7.
>>>Actually, many can and do use XHTML for web pages.
>>>>
>>>I looked at this page successfully using IE7. The web document
>>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>standards- setting (they use the term "recommendations"
>>>modestly instead of "standards") in strict XHTML. Go figure.
>>>>
>>Sure, you CAN make pages which will cater to the different
>>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>>
>>>There are various documents that can be googled that specify
>>>solutions wo using XHTML for broken browsers like Internet
>>>Explorer, such as using an XML stylesheet also to get around
>>>problems with showing XHTML in standards-violating,
>>>never-get-it-right HTTP clients like Internet Explorer. This
>>>is not rocket science.
>>>>
>>>>HTML does NOT require quotes on numeric attributes.
>>>Actually the HTML 4 recommendation does not assert in any way
>>>whatsoever that quotes can be omitted for attributes that have
>>>numeric values. It does allow for their omission, but
>>>recommends they always be used. There is no indication about
>>>whether this recommendation applies to the various levels of
>>>HTML: strict, transitional, frameset.
>>>>
>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>
>>Which backs up my claim that HTML does NOT require quotes on
>>numeric attributes.
>If you really want to split hairs, as you apparently want to do,
>the loosest usage of HTML doesn't require quotes on any attribute
>values except in the very few circumstances that your determined
>attempts to confuse the browser do not achieve the rendering you
>desire.
>>
>>>Here is one individual's take on SCRUPULOUSLY quoting all
>>>attribute values in HTML, which MUST be quoted in every case in
>>>XHTML:
>>>>
>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>
>>>He is or was a regular (long-time) and, I believe, respected
>>>contributer to the HTML usage newsgroups.
>>So? That's one person's opinion. Worth no more or less than
>>anyone else's opinion.
>Actually, the HTML standards keepers RECOMMEND (though they don't
>REQUIRE) you to quote attribute values----ALL OF THEM.
>>
>But then you have already established that you are a
>hair-splitter.
>>
>Perhaps you'd like to disparage the "opinions" of the HTML
>standards keepers too?
>>
>>Search enough and you can find an opinion you agree with
>>anywhere on the internet.
>Precisely right!
>>
>But then I am not so desperate to support my claims on the sole
>"opinion" of one kook with a web page against the 99,999 opinions
>of people who impress me with reason and logic and a certain
>level of erudition, some of whom actually sit on
>standards-setting committees like the one that promulgates the
>HTML specification.
>>
>Oh my!
>>
>A new word of the day:
>>
> http://www.merriam-webster.com/dictionary/consensus
For starters:
>
http://en.wikipedia.org/wiki/Internet_Explorer
>
"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
1.0 and DOM Level 1, with minor implementation gaps. It partially
supports CSS Level 2 and DOM Level 2, with major implementation
gaps and conformance issues. Full conformance to the CSS 2.1
specification is on the agenda for the final Internet Explorer 8
release.[32] It has no support for XHTML, though it can render
XHTML documents authored with HTML compatibility principles and
served with a text/html MIME-type."
>
And tens of thousands of similar pages.
What part of that XHTML page that I gave in the response (inserted
here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
not conform to the XHTML specification???

Tricking broken browsers---in HTTP response headers, in meta
elements, etc.----that don't comply with either the HTML or XHTML
specification--- notwithstanding your hilarious citation of a
Wikipedia article whose content is known to be notoriously
inaccurate---is not the fault of page developers. Perhaps instead
of recommending that page developers shy away from using XHTML in
STARK CONTRAST to the HTML specification writers URGING you to do
so, you should be telling them to include alternately served
documents with the simple statement urging their readers to stop
using broken browsers. Many developers do JUST that, just as many
developers that serve script-dependent content tell their readers
that the scientific/chemistry calculator they want to use won't
work unless they enable their browser to use scripts.

And in finishing:

Best practices are that attribute values in HTML---all of
them---are quoted, as RECOMMENDED by those who promulgated the HTML
specificiation. To insist on deviating from best practices is
altogether foolish.
If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail
to do that, that's your problem.

But you also haven't identified exactly WHAT is inaccurate about
this article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?

And I didn't say whether something was recommended or not. I said
that quotes were not REQUIRED around numeric values. And they are
not.

Pages validate quite well with W3C's only HTML validator when
numbers are not in quotes. It doesn't even give a warning.

Yeah, Transitional HTML is forgiving that way.

Set the validator for Strict HTML, and pretty much all of the
attributes you would want to use with numeric values are
disallowed---that is, generate an error on the validator. You are
supposed to be using a styling convention (CSS).

Like "width" and "height" in <imgtags?
>Set the validator to use the HTML Tidy option to----in its
words---CLEAN UP your HTML, and lo and behold, all your unquoted
attribute values--- every one of them---get quoted, and your doctype
is set to Transitional to allow the otherwise disallowed attributes
in Strict HTML.

What do you think that W3 is saying to the HTML page writer when it
"cleans up" the page this way?

I said nothing about transitional HTML. The same is true for strict
HTML.

This has NOTHING to do with whether the attributes are allowed or not
(in fact, all of the ones I use ARE valid - because I only write
strict HTML). And CSS is not for everything.

Sure, it the Tidy option adds quotes. But that does not mean they are
required. They are not - as you have said yourself.

As to what it does when it "cleans up the page" - that's its option.
But either way is still valid - as you have said yourself, quotes are
a recommendation - not a requirement. They are only required on
non-numeric values.
Required on non-numeric values?

The following valid HTML document gives two unquoted values for a paragraph
element and its values are non-numeric.

So much for requiring any compliance to recommendations (standards).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HTML pages really have should titles</title>
</head>
<body>

<p id=paragraph-1 class=aTypicalParagraph>
This paragraph specifies unquoted values for its attributes.

</body>
</html>

Nov 11 '08 #32
Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:

Seni Seven wrote:
Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>
>Seni Seven wrote:
>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>
>>>Seni Seven wrote:
>>>>Jerry Stuckle <js*******@attglobal.netwrote in comp.lang.php:
>>>>>
>>>>>Seni Seven wrote:
>>>>>>Jerry Stuckle <js*******@attglobal.netwrote in
>>>>>>comp.lang.php:
>>>>>>>
>>>>>>>Request-1 wrote:
>>>>>>>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
>>>>>>>>news:gf**********@registered.motzarell a.org...
>>>>>>>>>Request-1 wrote:
>>>>>>>>>>hi folks,
>>>>>>>>>>>
>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>aaaaaa!
>>>>>>>>>>>
>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a
>>>>>>>>>>page i converted from html to php.
>>>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>>>cookie to stop the repeating of an embedded video file on
>>>>>>>>>>a per session basis; i amended the php code to display a
>>>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>>>
>>>>>>>>>>worked fine.
>>>>>>>>>>>
>>>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>>>the JS.
>>>>>>>>>>>
>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>>
>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>>
>>>>>>>>>>any help much appreciated..
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>++++++++++++++++
>>>>>>>>>>>
>>>>>>>>>>{ echo "
>>>>>>>>>>>
>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>> <!-- begin
>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber
>>>>>>>>>> + '.jpg'>\");
>>>>>>>>>> // end -->
>>>>>>>>>></script>
>>>>>>>>>> "; }
>>>>>>>>>>>
>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>>
>>>>>>>>>>thanks
>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>Hi Jerry,
>>>>>>>>>
>>>>>>>>the single quote is actually necessary in JS when you're
>>>>>>>>using document.write to add strings in series (is it called
>>>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>>>the image path, like so,
>>>>>>>>>
>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>> echo "<!-- begin \n";
>>>>>>>> echo "document.write('<img src=\"images/swap/' +
>>>>>>>> picnumber +'.jpg\"
>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>>Training Image\">');\n";
>>>>>>>> echo "// end -->\n";
>>>>>>>> echo "</script>"; }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>>
>>>>>>>>anyway. i get really confused with all the nested stuff
>>>>>>>>and single-double quotes. i may try that "heredoc" thing
>>>>>>>>that Thomas suggested. I'll need a couple of beers first.
>>>>>>>>Friday night on Javascript? Bad!
>>>>>>>>>
>>>>>>>>>
>>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>>width, height and border. Only non-numeric data.
>>>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>>>be on all element attributes in that case, regardless of
>>>>>>attribute value type.
>>>>>>>
>>>>>>>
>>>>>1. There is no indication this is XHTML.
>>>>>2. You shouldn't use XHTML for web pages - it's not well
>>>>>supported by some browser, not the least being IE 6 and 7.
>>>>Actually, many can and do use XHTML for web pages.
>>>>>
>>>>I looked at this page successfully using IE7. The web document
>>>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>standards- setting (they use the term "recommendations"
>>>>modestly instead of "standards") in strict XHTML. Go figure.
>>>>>
>>>Sure, you CAN make pages which will cater to the different
>>>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>>>
>>>>There are various documents that can be googled that specify
>>>>solutions wo using XHTML for broken browsers like Internet
>>>>Explorer, such as using an XML stylesheet also to get around
>>>>problems with showing XHTML in standards-violating,
>>>>never-get-it-right HTTP clients like Internet Explorer. This
>>>>is not rocket science.
>>>>>
>>>>>HTML does NOT require quotes on numeric attributes.
>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>whatsoever that quotes can be omitted for attributes that have
>>>>numeric values. It does allow for their omission, but
>>>>recommends they always be used. There is no indication about
>>>>whether this recommendation applies to the various levels of
>>>>HTML: strict, transitional, frameset.
>>>>>
>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>>
>>>Which backs up my claim that HTML does NOT require quotes on
>>>numeric attributes.
>>If you really want to split hairs, as you apparently want to do,
>>the loosest usage of HTML doesn't require quotes on any attribute
>>values except in the very few circumstances that your determined
>>attempts to confuse the browser do not achieve the rendering you
>>desire.
>>>
>>>>Here is one individual's take on SCRUPULOUSLY quoting all
>>>>attribute values in HTML, which MUST be quoted in every case in
>>>>XHTML:
>>>>>
>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>>
>>>>He is or was a regular (long-time) and, I believe, respected
>>>>contributer to the HTML usage newsgroups.
>>>So? That's one person's opinion. Worth no more or less than
>>>anyone else's opinion.
>>Actually, the HTML standards keepers RECOMMEND (though they don't
>>REQUIRE) you to quote attribute values----ALL OF THEM.
>>>
>>But then you have already established that you are a
>>hair-splitter.
>>>
>>Perhaps you'd like to disparage the "opinions" of the HTML
>>standards keepers too?
>>>
>>>Search enough and you can find an opinion you agree with
>>>anywhere on the internet.
>>Precisely right!
>>>
>>But then I am not so desperate to support my claims on the sole
>>"opinion" of one kook with a web page against the 99,999 opinions
>>of people who impress me with reason and logic and a certain
>>level of erudition, some of whom actually sit on
>>standards-setting committees like the one that promulgates the
>>HTML specification.
>>>
>>Oh my!
>>>
>>A new word of the day:
>>>
>> http://www.merriam-webster.com/dictionary/consensus
>For starters:
>>
>http://en.wikipedia.org/wiki/Internet_Explorer
>>
>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
>1.0 and DOM Level 1, with minor implementation gaps. It partially
>supports CSS Level 2 and DOM Level 2, with major implementation
>gaps and conformance issues. Full conformance to the CSS 2.1
>specification is on the agenda for the final Internet Explorer 8
>release.[32] It has no support for XHTML, though it can render
>XHTML documents authored with HTML compatibility principles and
>served with a text/html MIME-type."
>>
>And tens of thousands of similar pages.
What part of that XHTML page that I gave in the response (inserted
here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
not conform to the XHTML specification???
>
Tricking broken browsers---in HTTP response headers, in meta
elements, etc.----that don't comply with either the HTML or XHTML
specification--- notwithstanding your hilarious citation of a
Wikipedia article whose content is known to be notoriously
inaccurate---is not the fault of page developers. Perhaps instead
of recommending that page developers shy away from using XHTML in
STARK CONTRAST to the HTML specification writers URGING you to do
so, you should be telling them to include alternately served
documents with the simple statement urging their readers to stop
using broken browsers. Many developers do JUST that, just as many
developers that serve script-dependent content tell their readers
that the scientific/chemistry calculator they want to use won't
work unless they enable their browser to use scripts.
>
And in finishing:
>
Best practices are that attribute values in HTML---all of
them---are quoted, as RECOMMENDED by those who promulgated the HTML
specificiation. To insist on deviating from best practices is
altogether foolish.
If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail
to do that, that's your problem.

But you also haven't identified exactly WHAT is inaccurate about
this article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?

And I didn't say whether something was recommended or not. I said
that quotes were not REQUIRED around numeric values. And they are
not.

Pages validate quite well with W3C's only HTML validator when
numbers are not in quotes. It doesn't even give a warning.
Yeah, Transitional HTML is forgiving that way.

Set the validator for Strict HTML, and pretty much all of the
attributes you would want to use with numeric values are
disallowed---that is, generate an error on the validator. You are
supposed to be using a styling convention (CSS).
Like "width" and "height" in <imgtags?
>>Set the validator to use the HTML Tidy option to----in its
words---CLEAN UP your HTML, and lo and behold, all your unquoted
attribute values--- every one of them---get quoted, and your doctype
is set to Transitional to allow the otherwise disallowed attributes
in Strict HTML.

What do you think that W3 is saying to the HTML page writer when it
"cleans up" the page this way?
I said nothing about transitional HTML. The same is true for strict
HTML.

This has NOTHING to do with whether the attributes are allowed or not
(in fact, all of the ones I use ARE valid - because I only write
strict HTML). And CSS is not for everything.

Sure, it the Tidy option adds quotes. But that does not mean they are
required. They are not - as you have said yourself.

As to what it does when it "cleans up the page" - that's its option.
But either way is still valid - as you have said yourself, quotes are
a recommendation - not a requirement. They are only required on
non-numeric values.

Required on non-numeric values?

The following valid HTML document gives two unquoted values for a paragraph
element and its values are non-numeric.

So much for requiring any compliance to recommendations (standards).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HTML pages really have should titles</title>
</head>
<body>

<p id=paragraph-1 class=aTypicalParagraph>
This paragraph specifies unquoted values for its attributes.

</body>
</html>
This is transitional, not strict.

But we have gotten way off of PHP. This is more suitable for alt.html.
I'm not going to carry this on any longer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 11 '08 #33

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: TristaSD | last post by:
Hi, Here's a nice footer I get inside every php page I write in wwwroot on my server. The code gets parsed just fine. I installed php5.2-win32 under W2K Server, IIS 5.0. I've installed php on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.