Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > HTML, XML, Javascript, AJAX
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 07-24-2007, 11:03 AM   #1 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
Scrolling Div Problem

Heya,

I have the following code that scrolls text contained inside a div, but when I change the text to two images, the div only scrolls to the end of the first image, and doesn't display the second. Why is this?

Code:
<html> <head><title></title> <style> .Pictures { WIDTH: 71px; HEIGHT: 51px; MARGIN-LEFT: 12px; MARGIN-BOTTOM: 12px; BORDER: 2px solid RGB(255, 255, 255); } #clippedDiv { POSITION: relative; WIDTH: 71px; HEIGHT: 51px; OVERFLOW: hidden; } </style> <script language="JavaScript" type="text/javascript"> // Scroll code var timeoutID; // global variable to hold the timer function scrollDiv(inc,dir) { /* inc(rement) is positive or negative, direction is v(ertical) or h(orizontal) */ if (timeoutID) clearTimeout(timeoutID); // make sure we do not start another timer var theDiv=document.getElementById('clippedDiv'); // get the hardcoded div if (theDiv) { // does it exist? if (dir == "v") theDiv.scrollTop+=inc; /* if vertical scroll increment the scrollTop to move down or up */ else theDiv.scrollLeft+=inc; // else increment scrollLeft to move right or left timeoutID = setTimeout("scrollDiv(" + inc + ",'" + dir + "')", 20); // do it again in 20 miliseconds } } function stopScroll() { // if (timeoutID) clearTimeout(timeoutID); // if we have a timerID clear it } </script> </head> <body> <div id="clippedDiv"><img class="Pictures" src="Images/1.bmp"><img class="Pictures"src="Images/2.bmp"></div> <img "../../images/nav/tri-lft.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(-4, 'h');" onmouseout="stopScroll();"> <img "../../images/nav/tri-rt.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(4, 'h');" onmouseout="stopScroll();"> </body> </html>
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote
Old 07-24-2007, 11:19 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
look at the image tag of your second image. tell us what's wrong with it.
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 07-24-2007, 11:58 AM   #3 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
Scrolling Div Problem

SDE,

What you mean 2.bmp?
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote
Old 07-24-2007, 12:35 PM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
<img class="Pictures"src="Images/2.bmp">
Now do you see what is wrong, or should it be more specific ?
class="Pictures"src=
Now do you see what is wrong, or should it be more specific ?
="Pictures"s
Now do you see what is wrong, or should it be more specific ?
s"s
Now do you see it ?
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 07-24-2007, 12:45 PM   #5 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
Scrolling Div Problem

SDE,

OK, I have changed the code and put a space in, but the second image still doesn't get displayed, when I scroll to it using the right small image (tri-rt.gif).

It just scrolls to the end of the first image, and THAT'S IT.

Why is this?

Code:
<html> <head><title></title> <style> .Pictures { WIDTH: 71px; HEIGHT: 51px; MARGIN-LEFT: 12px; MARGIN-BOTTOM: 12px; BORDER: 2px solid RGB(255, 255, 255); } #clippedDiv { POSITION: relative; WIDTH: 71px; HEIGHT: 51px; OVERFLOW: hidden; } </style> <script language="JavaScript" type="text/javascript"> // Scroll code var timeoutID; // global variable to hold the timer function scrollDiv(inc,dir) { /* inc(rement) is positive or negative, direction is v(ertical) or h(orizontal) */ if (timeoutID) clearTimeout(timeoutID); // make sure we do not start another timer var theDiv=document.getElementById('clippedDiv'); // get the hardcoded div if (theDiv) { // does it exist? if (dir == "v") theDiv.scrollTop+=inc; /* if vertical scroll increment the scrollTop to move down or up */ else theDiv.scrollLeft+=inc; // else increment scrollLeft to move right or left timeoutID = setTimeout("scrollDiv(" + inc + ",'" + dir + "')", 20); // do it again in 20 miliseconds } } function stopScroll() { // if (timeoutID) clearTimeout(timeoutID); // if we have a timerID clear it } </script> </head> <body> <div id="clippedDiv"><img class="Pictures" src="Images/1.bmp"><img class="Pictures" src="Images/2.bmp"></div> <img "../../images/nav/tri-lft.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(-4, 'h');" onmouseout="stopScroll();"> <img "../../images/nav/tri-rt.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(4, 'h');" onmouseout="stopScroll();"> </body> </html>
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote
Old 07-25-2007, 01:38 PM   #6 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 635
DJMaze is on a distinguished road
Quote:
Originally Posted by http://www.htmlgoodies.com/primers/html/article.php/3478181
Even though Internet Explorer will allow you to place an image as a BMP, I wouldn't. No other browsers will be able to display it. Go with .gif or JPEG.
So change the images first
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 07-26-2007, 03:08 AM   #7 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
OK done that, now what?
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote
Old 07-26-2007, 05:57 AM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
take the code out of a scrolling div and fix it first.
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 07-26-2007, 06:08 AM   #9 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
Scrolling Div Problem

SDE,

Both images get displayed when not inside the scrolling div, just not when they are. Why is this?
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote
Old 07-26-2007, 06:15 AM   #10 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
i don't know
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 07-26-2007, 06:21 AM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
make sure to tell us when you figure it out so other people searching the forums can learn.
__________________
testing 1 2 3
sde is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A small problem in the output the_master Standard C, C++ 1 12-17-2006 09:09 AM
parse error problem in game.. can't seem to find problem solution. slashdot Standard C, C++ 5 08-03-2005 08:15 PM
Hashing problem jodders Standard C, C++ 1 02-09-2005 01:51 PM
div problems falsepride HTML, XML, Javascript, AJAX 2 12-15-2004 10:40 AM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 04:44 PM


All times are GMT -8. The time now is 09:46 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle