RE: Javascript question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Robert Cummings [mailto:robert@xxxxxxxxxxxxx]
> Sent: Monday, March 02, 2009 4:18 PM
> To: Boyd, Todd M.
> Cc: PHP General list
> Subject: Re:  Javascript question
> 
> On Mon, 2009-03-02 at 16:11 -0600, Boyd, Todd M. wrote:
> > Before some of you newbies feel like being heroes and jump all over
> me:
> >
> > I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION,
> DON'T
> > ANSWER IT.
> >
> > Now that that's out of the way... I have a Javascript question (and
> > maybe a Browser/DOM question) for you folks. I'm not sure this is
> > anything they teach you in any online/in-seat/self-taught Javascript
> > course that I've ever seen before, so I figured I would bring it
> here.
> >
> > My boss asked me if I knew of a tool that would change the
<!DOCTYPE>
> of
> > a page on-the-fly to test validation in different schemes (i.e.,
> XHTML
> > Strict, Transitional, Loose, etc.). After a bit of looking around,
> this
> > is the solution I came up with (as a bookmarklet):
> >
> > javascript:document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
> 1.0
> > Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>' +
> > document.getElementsByTagName('html')[0].innerHTML);
> >
> > However, I'm not sure it will fire any validation events, since
> > technically the page has already been loaded (Javascript is just
> adding
> > more text). I fear the case will be the same if the current page's
> > source is sent to a new browser window.
> >
> > I'm not asking for any coding suggestions, necessarily--just curious
> as
> > to whether or not anyone knew if this will invoke browser validation
> > events or not. Comments and questions are more than welcome, though.
> :)
> 
> Can't you do it via PHP using a GET parameter? Seems more likely to
> work
> properly since it requires the page be reloaded on a fresh slate.
While
> at the same time, it will easily jump through the doctypes that the
> server deems suitable given the parameter
> 
>     http://www.www.www/foo.php?doctype=xmlstrict1.0

Rob,

Absolutely. However, requiring a server-side script was something I was
hoping to avoid. It may be useful as an intranet utility somewhere down
the road, but a bookmarklet was what I was shooting for for this first
test.

Great minds think alike, eh? :)


// Todd

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux