使用 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>