Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help! My whole class is stumped by the teacher\'s impossible request. We

ID: 3534705 • Letter: P

Question

Please help! My whole class is stumped by the teacher's impossible request.

We are to put a link on our home page of our ongoing project website (now has 5 pages) to open thumbnail images in yet another page (no problem doing this).


Then, a javascript window prompt asking them to enter the name of the image they would like to see larger. (no problem doing this)


The pop-prompt only opens when placed into an external .js file

but-

When the teacher showed me how to link the image, the pop-up will not work at all.


I cannot get the image link to open, I have tried every scenario to open an image using javascript. He said we shouldn't need to, but It is ok to use a dropdown, but this seems too complicated for what he is asking. (He does not want the image to just be 'clicked on' like any other normal website would allow. )


I have 'dumbed down' the program to divide and conquer



external Javascript


//thumbJava.js

x = window.prompt("Enter the image you would like to view");

if (x == 'a')

document.write( <a name="myimage01" target="_blank" href="images/a.jpg" height="75px" alt="a"/> );

Here is the html:

<!DOCTYPE html>

<html lang="en">

<head>

<title>Thumbnail</title>

<meta name="author" content="Lacy"/>

<meta name="description" content="Thumbnail"/>

<meta charset="utf-8">

</head>

<body>

<figure>

<img name="myimage01" src="images/a.jpg" height="75px" alt='a'/>

<figcaption>a</figcaption>

<img name="myimage02" src="images/b.jpg" height="75px" alt='b'/>

<figcaption>b</figcaption>

</figure>

<script src="thumbJava.js"></script>

</body>

</html>




images below in the same directory with folder named 'images'




Explanation / Answer

Please rate with 5 stars :)


Here is how you open a prompt box:

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
alert("I am an alert box!");
}
</script>
</head>
<body>

<input type="button" value="Show alert box">

</body>
</html>


Once done, you can do the rest of the things in the function.


For changing to HTML page, you can use: