This code works:
<script src="jquery.js"></script>
<script>
if (typeof jQuery == 'undefined') {
src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'
document.write('<script src="' + src + '"></scr' + 'ipt>')
}
</script>
<script>
[jQuery here]
</script>
But it contains a document.write, which is generally frowned upon. The
following version doesn't use document.write, but it also doesn't
work, despite there being no obvious reason why it shouldn't:
<script src="jquery.js"></script>
<script id="check">
if (typeof jQuery == 'undefined') {
var e = document.createElement('script')
e.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'
var check = document.getElementById('check')
check.parentElement.insertBefore(e, check.nextSibling)
}
</script>
I suspect that it needs to do the $(document).ready thing that jQuery
does, but of course since this code is meant to load jQuery it can't
be used directly.
<script src="http://goo.gl/LISf" title="jquery.js"></script>
<script>
if (!window.jQuery)
document.write(unescape('%3Cscript src="jquery.js"%3E%3C/script%3E'))
</script>
--
Sean B. Palmer, http://inamidst.com/sbp/
regards DaveP
> --
> Comment at http://groups.google.com/group/whits/topics
> Subscribe to http://inamidst.com/whits/feed
>
--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk
Thanks Pererinha, makes sense now.
regards
Oh, this is a reply to an old Whits thread:
http://groups.google.com/group/whits/t/77cd2f9ea5f079a4
I just hit reply to the original message that I sent, and figured it
would come up nicely threaded for anyone on the mailing list. Guess it
doesn't work for people who joined after the original message was sent
though!
I'm getting these as gmail emails, i.e. no threading?
Oddities of 'new' email modalities?
[Actually my first reaction was 'sbp has finally cracked' :-)]
Kidding Sean.
regards