View Single Post
Old 09-09-2010, 02:19 PM   PM User | #5
Leksiq
New to the CF scene

 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Leksiq is an unknown quantity at this point
If you should use inside an XSL file a script with document.write() and you cannot edit it(some counter for example), the next trick can help:

Code:
<script type="text/javascript">
// this is your script somewhere in HEAD
                        var document_write = '';
                        var obj = null;
                        document.write = function(str) {
                            document_write += str;
                        }
                        function begin(id) {
                            obj = document.getElementById(id);
                        }
                        function end() {
                            if(obj) {
                                obj.innerHTML = document_write;
                            }
                            document_write = '';
                        }

</script>

<!-- somewhere in BODY where you plan use another's script -->
<div id="some_id">
     <script type="text/javascript">begin('some_id');</script>
     <script type="text/javascript" src="http://www.other-domain.com/some_script_with_document_write.js"></script>
     <script type="text/javascript">end();</script>

</div>

Last edited by Leksiq; 09-09-2010 at 02:24 PM..
Leksiq is offline   Reply With Quote