Jump to content

Archived

This topic is now archived and is closed to further replies.

cameeob2003

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

Recommended Posts

Here is the code I am working with:

[code]<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>[/code]

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
use document.write("Your HTML");

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.