The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

HALP with javascript!

HofBrauHofBrau Registered User regular
edited May 2011 in Help / Advice Forum
Im currently doing a project in my HTML2 class where we need to fix someones website from HTML1 im trying to do alot of javascript with this website and encountered some hurtles, basically none of the javascript works as it should. i dropped all the code from the page that has the javascript in it into a spoiler, all of the said code was taken from a teachers powerpoint which is 5 years old or so so it uses a wierd font that isnt usable in CSE HTML i tried fixing it all, mostly wierd backwards quotes. anyways if anyone could help with this that would be great 8-)




<meta name="Alisa Helland" content="Kittens" />


<script type="text/javascript">

myPix = new Array("kitten1.jpg", "kitten1.jpg", "kitten2.jpg", "kitten3.jpg", "kitten.jpg4.jpg", "kitten5.jpg",)
imgCt = myPix.length

function choosePic() {
if (document.images) {
randomNum = Math.floor
((Math.random() * imgCt))
document.myPicture.src = myPix[randomNum]
}
}
</script>


<script>
if (document.images) {

button1home=new image
button2home=new image

button1gal=new image
button2gal=new image

button1type=new image
button2type=new image

button1care=new image
button2care=new image

button1mgsh=new image
button2mgsh=new image

button1home.src="home1.jpg"
button2home.src="home2.jpg"

button1gal.src="gal1.jpg"
button2gal.src="gal3.jpg"

button1type.src="type1.jpg"
button2type.src="type2.jpg"

button1care.src="care1.jpg"
button2care.src="care2.jpg"

button1mgsh.src="mgsh1.jpg"
button2mgsh.src="mgsh2.jpg"

else{
button1home=""
button1gal=""
button1type=""
button1care=""
button1mgsh=""
button2home=""
button2gal=""
button2type=""
button2care=""
button2mgsh=""


</script>
</head><center>
<center><img src=kitten-banner.jpg></center>
<body onLoad="choosePic()" bgcolor="#9966CC" Link=white Vlink=white Alink=white,>

<img src=kitten1.jpg name="myPicture">
<br>
<br>
<a href="index.html"
onMouseover="document.button1home.src='home2.jpg'"
onMouseout="document.button2home.src='home1.jpg'">
<img src="home1.jpg" border=0 name="button1"></a>

<a href=index1.html
onMouseover="document.gal1.src=button1gal.src"
onMouseout="document.button2gal.src=button2gal.src">
<img src="gal1.jpg" border=0 name="button2"></a>

<a href=index2.html
onMouseover="document.type1.src=button1type.src"
onMouseout="document.button2type.src=button2type.src">
<img src="type1.jpg" border=0 name="button3"></a>

<a href=index3.html
onMouseover="document.care1.src=button1care.src"
onMouseout="document.button2care.src=button2care.src">
<img src="care1.jpg" border=0 name="button4"></a>

<a href=http://www.district279.org/sec/mgsh/
onMouseover="document.mgsh1.src=button1mgsh.src"
onMouseout="document.button2mgsh.src=button2mgsh.src">
<img src="mgsh1.jpg" border=0 name="button5"></a>
</center>
<br>

<br />
<center><b><font face="arial"><font color="3607D1">The purpose of this web page is to learn all about kittens! You can learn how to take care of kittens and the different types of kittens! You can even look at a gallery that contains pictures of adorable kittens!</b></font></font></center>
<br />
<b><font face="arial"><font color=3607D1>
<center>Created By:</center>
<center>Alisa Helland</center>
<center><A href=mailto: [email]alisabeth.helland@hotmail.com>alisabeth.helland@hotmail.com[/email]</a></center>
<center>Last Updated:</center>
<center>March 4, 2011</center>
</font></b>



</body>
</html>

No gods or kings, just man.
HofBrau on

Posts

  • localh77localh77 Registered User regular
    edited May 2011
    This seems to border on "do my homework for me", so I don't think you'll get someone to just clean this up for you. However, I haven't written html/javascript in a while, but just glancing through, I see some obvious, basic problems:

    - There's a </head> tag, but no <head>
    - There are opening braces, but no closing braces, in some areas (like after the long if)
    - There are extra commas at the end of some of the tags
    - I think you need a closing tag for img elements (usually just "/>" instead of ">")

    localh77 on
  • HofBrauHofBrau Registered User regular
    edited May 2011
    By no means do i want you guys to do my homework for me =D i have alot of work to do on the website besides the homepage, i just need some heads up cause this code has been a head sore for the past 3 days.

    Oh and a little disclaimer i suck at code so dont expect the website to look good if you try looking at it.

    HofBrau on
    No gods or kings, just man.
  • ceresceres When the last moon is cast over the last star of morning And the future has past without even a last desperate warningRegistered User, Moderator Mod Emeritus
    edited May 2011
    Yeah, this is still doing your homework for you. Not what we're here for.

    ceres on
    And it seems like all is dying, and would leave the world to mourn
This discussion has been closed.