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 3615070
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:19:40+00:00 2026-05-18T22:19:40+00:00

I am trying to basically call a function from another javascript file (inside a

  • 0

I am trying to basically call a function from another javascript file (inside a javascript file) but it doesn’t seem to work.

In my main.html i have declared both files like so:

<script type="text/javascript" src="Jquery/jquery-1.4.4.js"> </script>
<script type="text/javascript" src="src/Reply.js"> </script>
<script type="text/javascript" src="src/Comment.js"> </script>

and inside Comment.js I call the function Reply() that is inside Reply.js..

Comment.js:

function Comment(message){
    var self = this;
    var message = message;
    //
    var comment = document.createElement("li");
    comment.id = "comment";
    comment.style = "display: none;";
    comment.textContent = message;
    //empty reply field
    var replyField = document.createElement("ul");
    replyField.id = "replyField";
    //create the appropriate buttons
    createButtons(comment);
    //append the replyField
    comment.appendChild(replyField);
    //insert into wall
    var parent = document.getElementById("wall");
    parent.insertBefore(comment,parent.firstChild);
    //effect after insertion
    $("ul#wall li:first").fadeOut();
    $("ul#wall li:first").fadeIn();

    return comment;
}

function newReplyTxtBox(comment){
    var buttons = comment.getElementsByTagName("input");
    buttons.item(0).disabled="disabled";

    var replyBox = document.createElement("div");
    replyBox.id="replyBox";

    var replyTxt = document.createElement("input");
    replyTxt.id="replyTxt";
    replyTxt.type="text";
    replyTxt.value="Write a reply";
    replyTxt.onfocus = function(e){if(this.value==this.defaultValue) this.value='';};
    replyTxt.onblur= function(e){if(this.value=='') this.value=this.defaultValue;};
    replyBox.appendChild(replyTxt);

    createButtons(replyBox);

    comment.appendChild(replyBox);  
}

function newReply(replyBox){
    var message = $("input#replyTxt").val();
    var reply = new Reply(message);
    replyBox.parentNode.remove(replyBox);
    var replyField = replyBox.parentNode.getElementsByTagName("ul").item(0);
    replyField.appendChild(reply);
}

the newReply() is simply called once you click on the “reply button” which is create like so:

var submitBtn = button.cloneNode();
        submitBtn.value = "submit";
        submitBtn.addEventListener("click", function(){newReply(parent)},false);
        parent.appendChild(submitBtn);

Reply.js:

function Reply(replyMsg){
    var self = this;

    var reply = document.createElement("li");
    reply.id="reply"
    reply.textContent = replyMsg;

    var deleteBtn = document.createElement("input");
    deleteBtn.value = "delete";
    deleteBtn.addEventListener("click", function(){deleteReply(reply)},false);

    reply.appendChild(deleteBtn);

    return reply;
}
function deleteReply(reply){
    reply.parentNode.removeChild(reply);
}
  • 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-18T22:19:41+00:00Added an answer on May 18, 2026 at 10:19 pm

    in the newReply function, try changing replyBox.parentNode.remove(replyBox);

    to replyBox.parentNode.removeChild(replyBox);

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

Sidebar

Related Questions

Is it possible to call a javascript function from the URL? I am basically
I'm basically trying to extract a Mac application from a zip file using QuaZip.
I am basically trying to trigger a function if the footer is inside the
I'm basically trying to do a dropdown jquery plugin. HTML <script type='text/javascript' src='script.js'></script> <div
Basically I am trying to call a function (function 1), that get the results
I'm trying to get the following Google Apps script to work, taken from another
I am trying to call my BHO method from the javascript. The problem is
I'm basically trying to convert a Unix timestamp (the time() function) to a relative
I'm basically trying to pass a method to another class to be called later,
I'm basically trying to get the target element from event.target and if not equal

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.