...

View Full Version : Locating pics



Plystire
01-12-2003, 12:17 AM
I have two images i am using...and i want to locate one on top of the other...

the first is called Frame.jpg and the one i want on top of it is Button1.gif

i tried locating button1 using the code as follows


<html>
<head>
<script type="text/javascript">
<!--
function placebut1()
{
if (document.all)
{
document.all("button1").style.left=100
document.all("button1").style.top=100
}
else if (document.layers)
{
document.layers["button1"].left=100
document.layers["button1"].top=100
}
}
//-->
</script>
</head>

<body bgcolor="#000000">
<script type="text/javascript">
placebut1()
</script>
<td><p align="center"><img name="Frame" src="Frame.jpg">
</td>
<span id="button1"><img name="Button1" src="Button1.gif" height="40"

width="40" border="0"></span>
</body>
</html>


can someone help me?

thx in advance

~PlystirE~

chrismiceli
01-12-2003, 12:26 AM
use the universal document.images[]


<html>
<head>
<script type="text/javascript">
<!--
function placebut1() {
document.images[0].style.top = 100; // or document.images["Button1"].style etc...
document.images[0].style.left = 100;
}
//-->
</script>
</head>

Plystire
01-12-2003, 04:43 AM
it didn't do anything different than the method i had :(

what am i doing wrong?

~PlystirE~

Plystire
01-12-2003, 06:06 AM
it gives me errors...i think it doesn't like my meathod of positioning the images

i'm getting really frustrated with it:mad:

~PlystirE~

chrismiceli
01-12-2003, 05:45 PM
try this.


<html>
<head>
<script type="text/javascript">
<!--
function placebut1() {
document.images[0].style.position = "absolute";
document.images[0].style.top = "100"; // or document.images["Button1"].style etc...
document.images[0].style.left = "100";
}
//-->
</script>
</head>

Plystire
01-12-2003, 07:18 PM
i found out why it wasn't working...for some reason it needed me to say


#button1 {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
width:40;
height:40;
}

and...

document.all("button1").style.visibility = "visible";

even though it was visible before :S

and now it locates to the position i want it to :)

thank you for the help chrismiceli

~PlystirE~



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum