Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: what to use...

  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    Agoo, La Union, Philippines
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    what to use...

    i need a script to draw elements into my webpage. something similar to using frames i guess. frames allows several pages to be displayed using framesets.
    i need something that will display several 'data' on a webpage.
    Is that possible? Is that what Dynamic HTML or getElementby ID is for?

    Please tell me which so i can start learning it ASAP. Also tell me if this is not under Javascript,so far, i have only managed to learn using javascript on my pages.
    thanks!

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    I guess you can use divs or other html elements for that matter to change parts of a given web page on the fly using JavaScript.

    After all, that is what Ajax is used for...and there are many techniques you can make use of to do this.

    Here is a simple example that alters the text on a given div once a page loads up

    Code:
    <html>
    <head>
    <title>Test</title>
    <script type="text/javascript">
    function changeText(ref) {
    var elem = window.document.getElementById( ref );
    var text = "This text has been replaced using JavaScript";
    elem.innerHTML = text;
    }
    </script>
    </head>
    <body onload="javascript: changeText('divChange');">
    <div id="divChange">
    If JavaScript is enabled...you shouldn't see this text.
    </div>
    </body>
    </html>
    I think using the document.getElementById is possibly the most used way to change text within HTML documents. There are other ways of course...and it all depend on what you are trying to achieve.

    You should refer to JavaScript references such as the following:
    1- http://developer.mozilla.org/en/docs/DOM
    2- http://www.javascriptkit.com/jsref/
    3- http://www.javascriptkit.com/domref/

    There are other reference you should note as well...but I personally find these very useful and have always referred to them when needed.

    All the best,
    Ess

  • #3
    New Coder
    Join Date
    Aug 2006
    Location
    Agoo, La Union, Philippines
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks!

    thanks!
    i'll look them up asap and see if it works well with what i need.

    just additional info. I use MS excel on my business and i use them alot.
    what im trying to figure out is to somehow draw the data from a different page and display it on my mainpage. i have little a bit of experience with javascript so the terms getElementbyID and DOM came to my mind not knowing exactly what it does.
    I use excel since its easy to reference data from other sheet/files into my main sheet. What im trying to do is put it up on the web so i can access it wherever and whenever. I might be asking the vaguest questions but i really dont know what to look for.
    Last edited by fontie; 02-19-2007 at 09:42 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •