Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8664829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:20:05+00:00 2026-06-12T17:20:05+00:00

I don’t know how I can synchronize next code: javascript: (function() { var s2

  • 0

I don’t know how I can synchronize next code:

javascript: (function() {
    var s2 = document.createElement('script');
    s2.src = 'http://192.168.0.100/jquery.js';
    document.body.appendChild(s2);
    s = document.createElement('link');
    s.rel = "stylesheet";
    s.href = "http://192.168.0.100/1.css";
    s.type = "text/css";
    document.body.appendChild(s);
})();
//var startTime = new Date().getTime();
//while (new Date().getTime() < startTime + 1000);
$(document).ready(function(){
    b="c:\\1.txt";
    var fso, f1; 
    fso = new ActiveXObject("Scripting.FileSystemObject");
    f1 = fso.CreateTextFile(b, true);
    f1.WriteLine("Testing") ;
    document.writeln("File " + b + " is created.");
});

When I run this script at first I get an error SCRIPT5009: '$' is undefined. I think that is because jQuery library is yet no loaded. When I try to run the same script after error’s appearencing – it behavior is corect. For synchonization I try to use code that is commented in upper listing. Is works (not always). But I understand that is no strict synchronization (it dependet of concrete situation). How can I use more clever synchronization?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:20:06+00:00Added an answer on June 12, 2026 at 5:20 pm

    This is due to the fact that putting in the script tag via appendChild dhtml method makes it evaluate async. To listen for it getting ‘ready’ as youre doing it on the document – follow this pattern

    (function() {
        var s2 = document.createElement('script');
        s2.src = 'http://192.168.0.100/jquery.js';
        document.body.appendChild(s2);
        s2.onload = s2.onreadystatechange = function(){
          if(s2.readyState == "complete") $(document).ready(function(){
            b="c:\\1.txt";
            var fso, f1; 
            fso = new ActiveXObject("Scripting.FileSystemObject");
            f1 = fso.CreateTextFile(b, true);
            f1.WriteLine("Testing") ;
            document.writeln("File " + b + " is created.");
          });
        }
        s = document.createElement('link');
        s.rel = "stylesheet";
        s.href = "http://192.168.0.100/1.css";
        s.type = "text/css";
        document.body.appendChild(s);
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know why, but this code worked for me a month ago... maybe
Don't know if anyone can help me with this or if it's even possible.
Don't know why this doesn't work. I can't do implicit animation for a newly
Don't understand this simple code: def main(): print (This program illustrates a chaotic function)
Don't know why I can't reply to people on here with only a small
Don't know why but I can't find a solution to this. I have 3
don't know better title for this, but here's my code. I have class user
Don't know much about running a function on every item in an array, still
Don't know how to frase this but I found this code wich works as
don't know if the title describes anything about what I'm trying to say but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.