Jump to content


Photo

Diplaying Html Through JAVA much like the PHP Echo""; tag HELP


  • Please log in to reply
3 replies to this topic

#1 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 30 July 2006 - 05:56 AM

Here is the code I am working with:

<script language="Javascript">
<!-- function -->

function changeRoster(teamID){
	switch(teamID){
		case '1':
		<div id="divleftmargin7px" style="position:absolute; top: 219px;">
			<img src="images/layout3_24.jpg" width="213" height="6" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 225px;">
			<img src="images/layout3_44.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player1.jpg" </div>
		<div id="divleftmargin57px" style="position:absolute; top: 225px;">
			<img src="images/layout3_46.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player2.jpg"</div>
		<div id="divleftmargin106px" style="position:absolute; top: 225px;">
			<img src="images/layout3_35.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player3.jpg"</div>
		<div id="divleftmargin163px" style="position:absolute; top: 225px;">
			<img src="images/layout3_37.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player4.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 225px;">
			<img src="images/layout3_39.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 256px;">
			<img src="images/layout3_40.jpg" width="213" height="22" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 278px;">
			<img src="images/layout3_31.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player5.jpg" </div>
		<div id="divleftmargin57px" style="position:absolute; top: 278px;">
			<img src="images/layout3_33.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player6.jpg"</div>
		<div id="divleftmargin107px" style="position:absolute; top: 278px;">
			<img src="images/layout3_49.jpg" width="13" height="31" alt=""></div>
		<div id="divleftmargin163px" style="position:absolute; top: 278px;">
			<img src="images/layout3_51.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player7.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 278px;">
			<img src="images/layout3_53.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 309px;">
			<img src="images/layout3_55.jpg" width="213" height="19" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player8.jpg"</div>
		break;
		case '2':
		<div id="divleftmargin7px" style="position:absolute; top: 219px;">
			<img src="images/layout3_24.jpg" width="213" height="6" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 225px;">
			<img src="images/layout3_44.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team2player1.jpg"</div>
		<div id="divleftmargin57px" style="position:absolute; top: 225px;">
			<img src="images/layout3_46.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team2player2.jpg"</div>
		<div id="divleftmargin106px" style="position:absolute; top: 225px;">
			<img src="images/layout3_35.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team2player3.jpg"</div>
		<div id="divleftmargin163px" style="position:absolute; top: 225px;">
			<img src="images/layout3_37.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team2player4.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 225px;">
			<img src="images/layout3_39.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 256px;">
			<img src="images/layout3_40.jpg" width="213" height="22" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 278px;">
			<img src="images/layout3_31.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team2player5.jpg" </div>
		<div id="divleftmargin57px" style="position:absolute; top: 278px;">
			<img src="images/layout3_33.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team2player6.jpg"</div>
		<div id="divleftmargin107px" style="position:absolute; top: 278px;">
			<img src="images/layout3_49.jpg" width="13" height="31" alt=""></div>
		<div id="divleftmargin163px" style="position:absolute; top: 278px;">
			<img src="images/layout3_51.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team2player7.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 278px;">
			<img src="images/layout3_53.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 309px;">
			<img src="images/layout3_55.jpg" width="213" height="19" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team2player8.jpg"</div>
		break;
		case '3':
		<div id="divleftmargin7px" style="position:absolute; top: 219px;">
			<img src="images/layout3_24.jpg" width="213" height="6" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 225px;">
			<img src="images/layout3_44.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team3player1.jpg"</div>
		<div id="divleftmargin57px" style="position:absolute; top: 225px;">
			<img src="images/layout3_46.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team3player2.jpg"</div>
		<div id="divleftmargin106px" style="position:absolute; top: 225px;">
			<img src="images/layout3_35.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team3player3.jpg"</div>
		<div id="divleftmargin163px" style="position:absolute; top: 225px;">
			<img src="images/layout3_37.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team3player4.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 225px;">
			<img src="images/layout3_39.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 256px;">
			<img src="images/layout3_40.jpg" width="213" height="22" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 278px;">
			<img src="images/layout3_31.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team3player5.jpg" </div>
		<div id="divleftmargin57px" style="position:absolute; top: 278px;">
			<img src="images/layout3_33.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team3player6.jpg"</div>
		<div id="divleftmargin107px" style="position:absolute; top: 278px;">
			<img src="images/layout3_49.jpg" width="13" height="31" alt=""></div>
		<div id="divleftmargin163px" style="position:absolute; top: 278px;">
			<img src="images/layout3_51.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team3player7.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 278px;">
			<img src="images/layout3_53.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 309px;">
			<img src="images/layout3_55.jpg" width="213" height="19" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team3player8.jpg"</div>
		break;
		case '4':
		<div id="divleftmargin7px" style="position:absolute; top: 219px;">
			<img src="images/layout3_24.jpg" width="213" height="6" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 225px;">
			<img src="images/layout3_44.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team4player1.jpg"</div>
		<div id="divleftmargin57px" style="position:absolute; top: 225px;">
			<img src="images/layout3_46.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team4player2.jpg"</div>
		<div id="divleftmargin106px" style="position:absolute; top: 225px;">
			<img src="images/layout3_35.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team4player3.jpg"</div>
		<div id="divleftmargin163px" style="position:absolute; top: 225px;">
			<img src="images/layout3_37.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team4player4.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 225px;">
			<img src="images/layout3_39.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 256px;">
			<img src="images/layout3_40.jpg" width="213" height="22" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 278px;">
			<img src="images/layout3_31.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team4player5.jpg" </div>
		<div id="divleftmargin57px" style="position:absolute; top: 278px;">
			<img src="images/layout3_33.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team4player6.jpg"</div>
		<div id="divleftmargin107px" style="position:absolute; top: 278px;">
			<img src="images/layout3_49.jpg" width="13" height="31" alt=""></div>
		<div id="divleftmargin163px" style="position:absolute; top: 278px;">
			<img src="images/layout3_51.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team4player7.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 278px;">
			<img src="images/layout3_53.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 309px;">
			<img src="images/layout3_55.jpg" width="213" height="19" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team4player8.jpg"</div>
		break;
		default:
		echo <div id="divleftmargin7px" style="position:absolute; top: 219px;">
			<img src="images/layout3_24.jpg" width="213" height="6" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 225px;">
			<img src="images/layout3_44.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player1.jpg"</div>
		<div id="divleftmargin57px" style="position:absolute; top: 225px;">
			<img src="images/layout3_46.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player2.jpg"</div>
		<div id="divleftmargin106px" style="position:absolute; top: 225px;">
			<img src="images/layout3_35.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player3.jpg"</div>
		<div id="divleftmargin163px" style="position:absolute; top: 225px;">
			<img src="images/layout3_37.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 225px;">
			document.rosterPics.playerOne.src = "team1player4.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 225px;">
			<img src="images/layout3_39.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 256px;">
			<img src="images/layout3_40.jpg" width="213" height="22" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 278px;">
			<img src="images/layout3_31.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin22px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player5.jpg" </div>
		<div id="divleftmargin57px" style="position:absolute; top: 278px;">
			<img src="images/layout3_33.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin71px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player6.jpg"</div>
		<div id="divleftmargin107px" style="position:absolute; top: 278px;">
			<img src="images/layout3_49.jpg" width="13" height="31" alt=""></div>
		<div id="divleftmargin163px" style="position:absolute; top: 278px;">
			<img src="images/layout3_51.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin170px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player7.jpg"</div>
		<div id="divleftmargin205px" style="position:absolute; top: 278px;">
			<img src="images/layout3_53.jpg" width="15" height="31" alt=""></div>
		<div id="divleftmargin7px" style="position:absolute; top: 309px;">
			<img src="images/layout3_55.jpg" width="213" height="19" alt=""></div>
		<div id="divleftmargin120px" style="position:absolute; top: 278px;">
			document.rosterPics.playerOne.src = "team1player8.jpg"</div>
		break;
	}
}

<!-- End of function -->
</script>

I am trying to get the <div> to diplay as they would through html and was wondering if there is any way to do this. All help is very much apprecriated.

#2 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 30 July 2006 - 06:07 AM

use sumthing like document.blah.blah = document.blah.blah+"<div blahh>"
i hav forgotten most of JS (so comes my blahs) but this is how you do it
I am a PHP Guru, ask me questions if you want to

#3 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 30 July 2006 - 07:12 AM

Is there a more explanitory way of putting this since I am a Java newb and this all comes as a blur without some explinations.

#4 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 30 July 2006 - 07:41 AM

use document.write("Your HTML");

but do it line for line, or it'll end up all on one line in your code

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users