This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

A simple javascript and html quest  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small conundrum.

here is my script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>St Cloud Orthopedics Associates, LTD.</title>
<link href="ortho.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var pic_width=100;
var pic_height=100;

/* define image urls */

if (document.images)
{
pic1= new Image(pic_width,pic_height);
pic1.src="/images/O2C.gif";
pic2= new Image(pic_width,pic_height);
pic2.src="/images/S2C.gif";

}

/* define text for image captions */


var pics= new Array(2)
pics[0]=pic1.src;
pics[1]=pic2.src;



var numpics=2;
var thenum=0;
imgName="logo";

function change_it()
{
if (document.images)
{
document.write("<img src='"+pics[thenum]+"' border='0' width='"+pic_width+"' height='"+pic_height+"' name='logo'>\n");

setTimeout('change_it2()',5000);
}
}

function change_it2()
{
var x=0;
thenum+=1;

if (thenum>numpics-1)
thenum=0;

document[imgName].src=pics[thenum];

x+=1;
setTimeout('change_it2()',5000);
}
//-->

</script>
</head>
<body>
<div id="wrapper">
<div id="header">

<script type="text/javascript">
<!--
change_it();
//-->
</script>
<p><strong>St. Cloud Orthopedic Associates, LTD.</strong><br />
1555 Northway Drive • (320) 259-4100<br />
St. Cloud, MN 56303</p>
</div>
</div>
</body>
</html>

the question is how do I setup the changeit() so it will work with my css so i can float it to the left and the <p> to the center?
 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the class attribute to the img tag and specify the appropriate class from your css file.
 
Tony Lavalle
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok doing that how would i call it from the img tag?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the class attribute to the line document.write("<img src

Eric
 
Tony Lavalle
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok got it. it works thank you both.
 
Ruth Stout was famous for gardening naked. Just like this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!