Re: nesting JS in echo's
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sun, 09 Nov 2008 18:44:32 -0500
Seni Seven wrote:
Jerry Stuckle <jstucklex@xxxxxxxxxxxxx> wrote in comp.lang.php:
Seni Seven wrote:Jerry Stuckle <jstucklex@xxxxxxxxxxxxx> wrote in comp.lang.php:Sure, you CAN make pages which will cater to the different browsers idiosyncrasies, but why? Where is the need for xhtml?
Seni Seven wrote:Actually, many can and do use XHTML for web pages.Jerry Stuckle <jstucklex@xxxxxxxxxxxxx> wrote in comp.lang.php:1. There is no indication this is XHTML.
Request-1 wrote:Are you talking about generating strict (X)HTML? Quotes must be on"Jerry Stuckle" <jstucklex@xxxxxxxxxxxxx> wrote in message news:gf2t4m$inr$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxBTW - you don't need quotes around numeric values like your width,Request-1 wrote:Hi Jerry,hi folks,You have an extra single quote before <img ...
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
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!
height and border. Only non-numeric data.
all element attributes in that case, regardless of attribute value
type.
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.
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 specifyWhich backs up my claim that HTML does NOT require quotes on numeric attributes.
solutions wo using XHTML for broken browsers like Internet Explorer,
such as using an XML style*** 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/sgmltut.html#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 attributeSo? That's one person's opinion. Worth no more or less than anyone else's opinion.
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.
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.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: nesting JS in echo's
- From: Seni Seven
- Re: nesting JS in echo's
- References:
- nesting JS in echo's
- From: Request-1
- Re: nesting JS in echo's
- From: Jerry Stuckle
- Re: nesting JS in echo's
- From: Request-1
- Re: nesting JS in echo's
- From: Jerry Stuckle
- Re: nesting JS in echo's
- From: Seni Seven
- Re: nesting JS in echo's
- From: Jerry Stuckle
- Re: nesting JS in echo's
- From: Seni Seven
- Re: nesting JS in echo's
- From: Jerry Stuckle
- Re: nesting JS in echo's
- From: Seni Seven
- nesting JS in echo's
- Prev by Date: Re: Anyone good at astronomy?
- Next by Date: Re: calculate time difference in mintues
- Previous by thread: Re: nesting JS in echo's
- Next by thread: Re: nesting JS in echo's
- Index(es):