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 Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php