/    Sign up×
Community /Pin to ProfileBookmark

Help with phantom space.

I have the following javascript and it works as it should, a new image is loaded each time the page is loaded.

var imagenumber = 5 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;
var URLs = new Array() ;
images = new Array
images[1] = “images/headerpics/h1.jpg”
images[2] = “images/headerpics/h2.jpg”
images[3] = “images/headerpics/h3.jpg”
images[4] = “images/headerpics/h4.jpg”
images[5] = “images/headerpics/h5.jpg”

var image = images[rand1] ;
var linknumber = 1 ;
var img1 = Math.round( (linknumber-1) * randomnumber) + 1 ;
links = new Array
links[1] = “index.htm”

var link = links[img1];
document.write(‘<a href=”‘ + link + ‘”><img src=”‘ + image + ‘” border=”0″></a>’) ;

Here is the html code to call the script,

<!– START ROTATING HEADER GRAPHICS –>

<script language=”JavaScript”
type=”text/JavaScript” src=”javascripts/headerpics.js”>

</script>

<!– END ROTATING HEADER GRAPHICS –>

The issue is that a small space is created under the image when it loads using the javascript.

I have a table created with two rows with a menu bar in the bottom row and the images load in the top row. If I just place an image in the top row it looks fine. If I use the script to randomly load the images there is a small space under the image or between the top row and bottom row.

Any suggestions??

Thanks!

Joe

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@webdoneauthorAug 14.2013 — I have the following javascript and it works as it should, a new image is loaded each time the page is loaded.


var imagenumber = 5 ;

var randomnumber = Math.random() ;

var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;

var URLs = new Array() ;

images = new Array

images[1] = "images/headerpics/h1.jpg"

images[2] = "images/headerpics/h2.jpg"

images[3] = "images/headerpics/h3.jpg"

images[4] = "images/headerpics/h4.jpg"

images[5] = "images/headerpics/h5.jpg"



var image = images[rand1] ;

var linknumber = 1 ;

var img1 = Math.round( (linknumber-1) * randomnumber) + 1 ;

links = new Array

links[1] = "index.htm"

var link = links[img1];

document.write('<a href="' + link + '"><img src="' + image + '" border="0"></a>') ;

Here is the html code to call the script,

<!-- START ROTATING HEADER GRAPHICS -->

<script language="JavaScript"

type="text/JavaScript" src="javascripts/headerpics.js">


</script>

<!-- END ROTATING HEADER GRAPHICS -->

The issue is that a small space is created under the image when it loads using the javascript.

I have a table created with two rows with a menu bar in the bottom row and the images load in the top row. If I just place an image in the top row it looks fine. If I use the script to randomly load the images there is a small space under the image or between the top row and bottom row.

Any suggestions??

Thanks!

Joe[/QUOTE]



I may have gotten it. I'm using FrontPage and when I view the page using Front Page is shows the space if I view it on the web it looks fine with a little tweaking of the table. What i mean by tweaking the table is that I'm using a background image in the top row of the table and I had to move the top of the bottom row up to remove the space. In doing so however, in FrontPage design mode, the row is not tall enough to show the whole background image in design mode but looks fine on the web or in preview mode except for the space is there. Go figure...

I don't know near enough about this stuff.

Any input would still be helpful.
Copy linkTweet thisAlerts:
@007JulienAug 14.2013 — Without CSS style an image is a inline block. Then, if the height of the image is not a multiple of the line-heigth a space appears at the top of the image... To solve this problem change the class of this image with a class {display:block} and leave the table's td take the corresponding height...
×

Success!

Help @webdone spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...