Thread: Quick HTML question

  1. #1
    #include <me!> Flakster's Avatar
    Join Date
    May 2005
    Location
    Canada
    Posts
    50

    Quick HTML question

    I have a small piece of javascript in my HTML that picks a random picture every few seconds and displays it. ( Got it with help from the boards a few days ago, Props!)

    I want it to be right againest the edge of the window when viewed, is there any way through alignment tags I can achieve that? <align="left"> doesn't work. No matter what I do, I still end up with a small space a couple millimeteres wide inbetween the pictures and the edge of the window.

    Any suggestions?

  2. #2
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    Either in CSS or in the body tag, set margin=0 and padding=0.

  3. #3
    Registered User xxxrugby's Avatar
    Join Date
    Jan 2005
    Posts
    178
    or try
    table border="0" cellpadding="0" cellspacing="0"
    and align="left"
    Sorry for spelling errors, not English!
    xxxrugby: "All Human Race Will Die From My Hand!"
    xxxrugby: "We are all philosophers, when question is about politics!"

  4. #4
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Follow Ober's suggestion, and also you can try:

    <p align="right">
    <img....>
    </p>

  5. #5
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    Wow... talk about taking the long way around.

  6. #6
    #include <me!> Flakster's Avatar
    Join Date
    May 2005
    Location
    Canada
    Posts
    50
    The problem with...

    <p align="right">
    <img....>
    </p>

    is that it isn't actually an image, it's just javascript bringing up images.

  7. #7
    #include <me!> Flakster's Avatar
    Join Date
    May 2005
    Location
    Canada
    Posts
    50
    This is the script if anyone was wondering...

    Code:
    <script language="javascript">
    
    
    var delay=2000 //set delay in miliseconds
    var curindex=0
    
    var randomimages=new Array()
    
    	randomimages[0]="1.jpg"
    	randomimages[1]="2.jpg"
    	randomimages[2]="3.jpg"
    	randomimages[3]="4.jpg"
    	randomimages[4]="5.jpg"
    	randomimages[5]="6.jpg"
    	randomimages[6]="7.jpg"
    	randomimages[7]="8.jpg"
    	randomimages[8]="9.jpg"
    var preload=new Array()
    
    for (n=0;n<randomimages.length;n++)
    {
    	preload[n]=new Image()
    	preload[n].src=randomimages[n]
    }
    
    document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
    
    function rotateimage()
    {
    
    if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
    curindex=curindex==0? 1 : curindex-1
    }
    else
    curindex=tempindex
    
    	document.images.defaultimage.src=randomimages[curindex]
    }
    
    setInterval("rotateimage()",delay)
    
    </script>

  8. #8
    Bob Dole for '08 B0bDole's Avatar
    Join Date
    Sep 2004
    Posts
    618
    in <body> set margins to 0, use a div tag to align it to the left
    Hmm

  9. #9
    Registered User
    Join Date
    Jun 2005
    Posts
    4
    not sure why ur saying to do all this stuff tbh

    just put in the body tag
    <body leftmargin="0"> (and any others you want eg. topmargin="0")

    and if u have it in a table do what xxxrugby said as well

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick question about replacing laptop harddrive
    By PJYelton in forum Tech Board
    Replies: 4
    Last Post: 01-20-2005, 08:02 PM
  2. Quick File Input Question
    By ProjectsProject in forum C Programming
    Replies: 2
    Last Post: 11-04-2004, 11:39 AM
  3. Quick Question on File Names and Directories
    By Kyoto Oshiro in forum C++ Programming
    Replies: 4
    Last Post: 03-29-2002, 02:54 AM
  4. * quick question *
    By SavesTheDay in forum C Programming
    Replies: 3
    Last Post: 03-27-2002, 06:58 PM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM