View Full Version : what to use...

Feb 18th, 2007, 10:20 AM
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.

Feb 18th, 2007, 02:16 PM
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

<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;
<body onload="javascript: changeText('divChange');">
<div id="divChange">
If JavaScript is enabled...you shouldn't see this text.

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,

Feb 19th, 2007, 09:27 AM
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.