Jump to content

Change text on click


Xsound

Recommended Posts

Hey guys , I have this script to change image when I click a text with a ID set to "billede" .. The source look like this:

<script language="JavaScript"><!--		pictures = new Array(2)			  var current_image=1;			  pictures[1] = "pic1.gif"			  pictures[2] = "pic2.gif"			  pictures[3] = "pic3.gif"			  pictures[4] = "pic4.gif"			  function changeImage(imageNo)			   {				 <!--document.images.billede.src = "graphics" + pictures[imageNo];-->				 current_image=imageNo;				 document.images.billede.src = "grafik/" + pictures[imageNo];				 			   }			   			 function next()			 {			 	if (current_image<pictures.length-1)			 	{			 	 	current_image++;			 		document.images.billede.src = "grafik/" + pictures[current_image];				 	}			 }			 			 function last()			 {			 	if (current_image>1)			 	{			 	 	current_image--;			 		document.images.billede.src = "grafik/" + pictures[current_image];				 	}			 }//--></script>

Now I wont to write it over so it change text on click .. so I did this (never tried javascript before only ASP/HTML/CSS )

<script language="text/JavaScript"><!--		tekst = new Array(2)			  var current_text=1;			  tekst[1] = "Brokenshell 10x10"			  tekst[2] = "Dogsnose 40x40"			  tekst[3] = "LesAmis Friends 40x40"			  tekst[4] = "Officespoon 40x40"			  function changeTekst(textNo)			   {				 <!--document.write.pictext.src = tekst[textNo];-->				 current_text=textNo;			 		document.write.pictext.src = tekst[textNo];						 			   }			   			 function next()			 {			 	if (current_text<tekst.length-1)			 	{			 	 	current_text++;			 		document.write.pictext.src = tekst[textNo];				 	}			 }			 			 function last()			 {			 	if (current_text>1)			 	{			 	 	current_text--;			 		document.write.pictext.src = tekst[textNo];				 	}			 }//--></script>

where did I make mistakes? please help me .. (:

Link to comment
Share on other sites

I found out :) Some nice (geeky but CRAZYcoder) friend helped me.. /cheer :) You can always add my msn if you want the code.. Its a imageswapping javascript which swap both text and image on one click.msn@xsound.dk :) HF and GL in future all

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...