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

  • Home
  • SEARCH
  • 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 5994459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:49:14+00:00 2026-05-22T23:49:14+00:00

//================MyJs.js========================= var objGreeting = { Greetings : function() { toolbardiv = document.createElement(‘toolbardiv’); // create

  • 0
//================MyJs.js=========================
var objGreeting = {
   Greetings : function() {
   toolbardiv = document.createElement('toolbardiv'); // create div tag dynamically
   toolbardiv.setAttribute('id',"toolbar"); // give id to it
   toolbardiv.className="top"; // set the style classname

  //set the inner styling of the div tag
   toolbardiv.style.position="absolute";

   //set the html content inside the div tag
   toolbardiv.innerHTML="<input id='Greeting-Button' type='button' value='Login'           onClick='objHello.SayHello()'/>"
   }
},

var objHello = {

   SayHello: function() {
   alert("Hello World");
   }
};

Right now this all is in a single JS file and it’s working fine.

Now I want to separate the two classes above into two different js files.
But after doing this I am not able to call the SayHello method.

I am using “GreaseMonkey for IE” and IE8 to run this script.

  • 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-05-22T23:49:15+00:00Added an answer on May 22, 2026 at 11:49 pm

    To have your script insert JS dynamically, you can use something like the following:

    function addJS_Node (text, s_URL)
    {
        var scriptNode                      = document.createElement ('script');
        scriptNode.type                     = "text/javascript";
    
        if (text)  scriptNode.textContent   = text;
        if (s_URL) scriptNode.src           = s_URL;
    
        document.head.appendChild (scriptNode);
    }
    
    addJS_Node (null, 'YourPath/YourJS_File.js');
    

    Note that I don’t use IE, so code is untested on that platform but should work.

    Depending on the web page, document.body.appendChild may work better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Designed the Javascript function My.js it contains following code My.js function display(){
I use the following pattern in my JS: var lib = { module_one: {
Given a table such as the following: <tbody> <%foreach (var book in Model.Books) {
I need to pack all my js, but need to edit it going into
I am using JavaScript and jQuery. My main file has My.js and Ajax. My.js
I need to append a variable to all Javascript files while they are included
When server side code is updated (related to JavaScript) the old JavaScript files are
Not sure if I am doing this correctly or not. Here is my .js
I have a question. I have a work this morning but i don't know
I am using PHP, jQuery, and JSON. Now I need to know how to

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.