[thelist] Javascript Validation Help - Comodo TrustLogo Display Script

Matt Warden mwarden at gmail.com
Sun Feb 12 18:53:58 CST 2006

Hash: SHA1

Ron Dorman wrote:
> I modified the document.writeln as suggested and it did get rid of the 
> 'element not allowed here' error but threw another error due to and 
> invalid attribute "scr not a valid element" or token name.
> I tried breaking it up into two scripts as follows:
> <script type="text/javascript">
> var cot_loc0=(window.location.protocol == "https:")? 
> "https://secure.comodo.net/trustlogo/javascript/cot.js" :
> "http://www.trustlogo.com/trustlogo/javascript/cot.js";
> </script>
> <script type="text/javascript" src="'+cot_loc0+'"></script>
> And it didn't generate and errors in the validator, but it no longer 
> works to display the TrustLogo either. Either I have the syntax wrong or 
> it isn't going to work as seperate scripts.

Yes, this won't work because the src attribute is not in the context of
a script. You could try a hack like the following, but I don't know if
it will work and if it does I probably wouldn't want to use it anyway:

<script type="..." src="javascript:cot_loc0"></script>

Now, for the non-hackish shot-in-the-dark, inserting the script element
via DOM:

<script type="text/javascript">
var cot_loc0=(window.location.protocol == "https:")?
"https://secure.comodo.net/trustlogo/javascript/cot.js" :

if (document.getElementsByTagName && document.createElement) {
    var head = (document.getElementsByTagName('head'))[0];
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = cot_loc0;

I haven't tried this ebfore, but I've heard it thrown around on the JSAN
list as a way to dynamically include dependencies, so it must work to
some degree.

- --
Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the thelist mailing list