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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:42:55+00:00 2026-05-13T00:42:55+00:00

I’ve been adding quite a bit of javascript to my pages lately, but have

  • 0

I’ve been adding quite a bit of javascript to my pages lately, but have learned it all in classic seat-of-the-pants fashion. When I want my page to do something, I google and experiment until I get the result I want.

I frequently have objects in my pages that I want to activate/deactivate, hide, show, etc., but – having missed the rigorous introduction to javascript – I’ve no idea how these things get named. I click on objects with firebug open, expecting to see some fully-qualified name for the object, but get no joy. I just need to be able to do something like form.button.value=”something”, and need to know the name of that object.

Any ideas?

Thanks.

  • 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-13T00:42:55+00:00Added an answer on May 13, 2026 at 12:42 am

    Whilst you are running Javascript code, you have all the local variables in the current scope, so if you had the following code:

    var myObject = New Object();
    myObject.Person = New Object();
    myObject.Person.Name = "Mark";
    myObject.Person.Gender = "Male";
    myObject.Name = "object1";
    

    … your root object would be myObject, and you refer to descendent objects through the dot notation.

    However, thanks to the implementation of the DOM in the browser, you also inherit the window object via the this keyword. In fact, you can leave the this keyword out for simple situations i.e. when you are not using closures. Therefore, you can access Javascript functions at the top level by just using the function name.

    If you want to access specific elements, like it sounds like you are wanting, you need to learn the DOM, and not use the syntax that you were suggesting (that sounds like 1990s Javascript). The root element you need to know is the HTMLDocument object, accessed via the document property. You can discover elements with specific Id (not Name) attributes by using the getElementById method of the document element. Of course, it helps if you’ve given your element an unique Id from the start. You can also recursively use the childNodes collection to iterate manually through elements until you find what you want. Alternatively, if you really can’t supply an Id, you could also use the getElementsByTagName method, which is attached to every element in the DOM.

    Example:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
    <HEAD>
        <TITLE></TITLE>
        <META NAME="Generator" CONTENT="TextPad 4.6">
        <META NAME="Author" CONTENT="?">
        <META NAME="Keywords" CONTENT="?">
        <META NAME="Description" CONTENT="?">
        <SCRIPT LANGUAGE="Javascript">
            <!--
    
            function DoSummat()
            {
                var divInside = document.getElementById("Inside");
                divInside.textContent = "This text will appear inside.";
            }
    
            //-->
        </SCRIPT>
    </HEAD>
    
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">
    <FORM>
        <INPUT TYPE="BUTTON" onclick="DoSummat();" NAME="MyButton" VALUE="Press Me">
    </FORM>
    <DIV ID="Outside">
        <DIV ID="Middle">
            <DIV ID="Inside"></DIV>
        </DIV>
    </DIV>
    </BODY>
    </HTML>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.