임의의 배열에 이미지를 추가하려고합니다. 기본적으로이 무작위 제너레이터는 어떤 영화를보아야하는지 알려주고 제목 아래에 움직이는 이미지를 추가하는 방법을 알아 내려고합니다. 아마도 가장 좋은 방법은 이미지 URL이있는 두 번째 배열을 만들고 + 및 대괄호를 사용하여 기존 배열에 추가하는 것일 수 있습니다. 이미지를로드하는 스크립트를 얻는 방법을 모르겠습니다.이미지 URL 배열을 만들고 기존 배열에 추가하고 jQuery를 사용하여 이미지를로드 할 페이지를 얻으려면 어떻게해야합니까?
<head>
<link
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-
awesome.min.css"
rel="stylesheet" type='text/css'>
<h1 style="text-align: center; color: red; font-family: verdana; font-
weight: bold;">WHAT CHRISTMAS MOVIE SHOULD I WATCH?</h1>
</head>
<body>
<div class="container">
<div id="generator" style="padding-top: 10px;">
<p>
<i class="fa fa-snowflake-o fa-5x spin"></i>
<i class="fa fa-gift fa-5x spin"></i>
<i class="fa fa-tree fa-5x spin"></i>
</p>
<input type="button" id="btnSearch" value="What Christmas Movie Should I
Watch?" onclick="GetValue();" />
<p id="message"></p>
</div>
<div id="picture"></div>
</div>
JQuery와
function GetValue()
{
var myarray= new Array("The Santa Claus", "Just Friends","Home Alone", "Home
Alone 2","Serendipity","Love Actually","Elf","Christmas Vacation","A
Christmas Story","The Grinch","Jingle All the Way","Rudolph the Red-Nosed
Reindeer","Ernest Saves Christmas","Frosty the Snowman","The Muppet
Christmas Carol","The Nightmare Before Christmas","Jesus of Nazareth
1977","Bad Santa");
var random = myarray[Math.floor(Math.random() * myarray.length)];
//alert(random);
document.getElementById("message").innerHTML=random;
}