Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-12-2003, 12:17 AM   PM User | #1
Plystire
New Coder

 
Join Date: Jan 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Plystire is an unknown quantity at this point
Question Locating pics

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
Quote:
<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~
__________________
CHAOS! DISORDER! MAYHEM!
My job here is obviously done.
~ Plystire
Plystire is offline   Reply With Quote
Old 01-12-2003, 12:26 AM   PM User | #2
chrismiceli
Regular Coder

 
Join Date: Sep 2002
Location: Louisiana
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
chrismiceli is an unknown quantity at this point
use the universal document.images[]
Code:
<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>
__________________
DevEdge - MSDN - DevGuru
chrismiceli is offline   Reply With Quote
Old 01-12-2003, 04:43 AM   PM User | #3
Plystire
New Coder

 
Join Date: Jan 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Plystire is an unknown quantity at this point
Unhappy nope

it didn't do anything different than the method i had

what am i doing wrong?

~PlystirE~
__________________
CHAOS! DISORDER! MAYHEM!
My job here is obviously done.
~ Plystire
Plystire is offline   Reply With Quote
Old 01-12-2003, 06:06 AM   PM User | #4
Plystire
New Coder

 
Join Date: Jan 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Plystire is an unknown quantity at this point
errors

it gives me errors...i think it doesn't like my meathod of positioning the images

i'm getting really frustrated with it

~PlystirE~
__________________
CHAOS! DISORDER! MAYHEM!
My job here is obviously done.
~ Plystire
Plystire is offline   Reply With Quote
Old 01-12-2003, 05:45 PM   PM User | #5
chrismiceli
Regular Coder

 
Join Date: Sep 2002
Location: Louisiana
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
chrismiceli is an unknown quantity at this point
try this.
Code:
<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>
__________________
DevEdge - MSDN - DevGuru
chrismiceli is offline   Reply With Quote
Old 01-12-2003, 07:18 PM   PM User | #6
Plystire
New Coder

 
Join Date: Jan 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Plystire is an unknown quantity at this point
Lightbulb found it

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~
__________________
CHAOS! DISORDER! MAYHEM!
My job here is obviously done.
~ Plystire
Plystire is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:21 AM.


Advertisement
Log in to turn off these ads.