使用jQuery,你可能需要將你的圖片剪成片段以適應文本內部。
<script type="text/javascript">
function getRandomText()
{
var verbs=['Butcher','Punish','Impoverish','Annihilate','Dispossess','Humiliate','Denounce','Vilify','Torture','Execute','Shaft'];
var victims=['single mothers','young people','the disabled','benefit scroungers','council tenants','council estate riff-raff','human rights lawyers','do-gooders','judges who say I am wrong','the poor'];
var outcomes=['until they vote Tory','with a spoon','with a cattle prod','with a Taser','with a spoon','during a zombie apocalypse'];
var endings=[' and then cut their benefits.',', then let Dementors suck out their lifeforce.',', then give bankers another bailout.',' and then make them work for nothing.','. I will pass emergency regulations to make it legal.',' and send their relatives to the workhouse.',', then let them eat cake.'];
for(x=0;x<Math.round(Math.random()*10);x++){
var _JuNk=Math.random();
}
return verbs[Math.round(Math.random()*(verbs.length-1))]+' '+victims[Math.round(Math.random()*(victims.length-1))]+' '+outcomes[Math.round(Math.random()*(outcomes.length-1))]+endings[Math.round(Math.random()*(endings.length-1))]+'\n';
}
$(document).ready(function() {
$("#Refresh").click(function() {
var randomText = getRandomText();
$("#Result").html(randomText);
})
});
</script>
</head>
<body>
<div class="container">
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<button id="Refresh">More...</button>
<div class="picture">
<table class="table">
<tr>
<td>Top Left</td>
<td>Top Center</td>
<td>Rop RIght</td>
</tr>
<tr>
<td>Middle Left</td>
<td><div id="Result">Balloon Content</div></td>
<td>Middle Right</td>
</tr>
<tr>
<td>Bottom Left</td>
<td>Bottom Center</td>
<td>Bottom Right</td>
</tr>
</table>
</div>
</div>
<!-- end .content -->
</div>
<!-- end .container -->
</div>
</body>
發佈一些代碼,說明你在做什麼,將是我看中文。這將允許答案給出可以幫助你的特定代碼。 – Jesse 2013-02-24 06:12:40
@Jesse,我試着在這個評論中發佈一些文本生成器代碼,但是沒有足夠的空間來發布整個腳本。我會盡量張貼。謝謝。 – PaulX 2013-02-24 06:25:19