PDA

View Full Version : Java scripts positioning


suriya6in
09-28-2002, 07:56 AM
hi guys,

My query is, how to set the output of any java script to appear in a particular place of my webpage?
If i copy and paste the script in the HTML editor, the output is appearing in the default position, but not in a particular position of the webpage, where i exactly need to be.

can anyone give me a solution for this?

regards
suriya

SIGINT
09-28-2002, 08:51 AM
Hi,
why don't you use DIV ???
If you're using document.write() then place the code,where you want the output to be displayed...

Sincerly SIGINT

suriya6in
09-28-2002, 09:10 AM
hi
thanx for your reply.
But i don't know much about HTML scripting.
Can u explain me how to use <div> or document.write() over my javascript.
Step by step explanation needed!

regards
suriya

SIGINT
09-28-2002, 10:57 AM
Hmmm,
if you code in JavaScript you should know HTML,otherwise JavaScript is boring...

<DIV id="name">Content</DIV>

DIV is a tag to create some type of layer (similar to LAYER in Netscape). You can place this layer everywhere on your HTML document where you want.A DIV can hold almost every HTML tag as Content,so

<DIV id="image" style="position:absolute;top:20px;left:40px">
<IMG src="this.jpg">
</DIV>

would create an image object at position 20px from top and 40px from left.

If you want an HTML reference look at: http://www.selfhtml.com

Sincerly SIGINT

Mr J
09-28-2002, 04:28 PM
SIGINT is on the right track there.

To output to a particular place on your page set up a DIV container for positioning.

<DIV id="oDIV1" style="position:absolute;left:100;top:100">
Your contents
</DIV>


Then you need to target your script output at the container using:

oDIV1.innerHTML=script output

Try the simple example below


<DIV id="oDIV1" style="position:absolute;left:100;top:100">
What is 5 times 5
</DIV>
<script>
function totup(){
a=5*5
oDIV1.innerHTML="5 times 5 equals " + a
}
setTimeout("totup()",3000)
</script>



You can have default text/image in the DIV to start with then change the contents with a script.

adios
09-28-2002, 05:31 PM
DIV is a tag to create some type of layer (similar to LAYER in Netscape).

?????

http://www.htmlcompendium.org/attributes-list/Adiv.htm