• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

A simple javascript and html quest

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok got it. it works thank you both.
 
reply
    Bookmark Topic Watch Topic
  • New Topic