如何通过链接使图像显示在另一页上

时间:2014-03-27 14:34:52

标签: javascript jquery html css

此处已完成新手,但我有一个链接到html页面的警告框,我需要在点击链接后才在此页面中显示图像。已经查看了cookie和本地存储,但我没有到达任何地方。

到目前为止,这是我的代码:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>City Soldiers Question 1 Page</title>
<meta name="viewport" content="width=width, initial-scale=1.0">
<link href="stickerbook.css" rel="stylesheet" type="text/css" media="screen">
<link rel="stylesheet" href="mobile.css" media="screen and (max-width:480px)"/>

<script>

function correct() {
    var sticker = window.confirm("Correct! Go to Sticker Collection page.");
    if (sticker){
        window.location="GalleryCS.html";
    }
}

</script>

</head>

<body>
<div id ="wrapper" >
    <div id ="logo">  
        <img src="mol_fulllogo.fw.png" alt= "Museum of Liverpool" width="400" height="106">
    </div>
    <div id ="mobilelogo"> 
        <img src="mol_logo.png" alt= "Museum of Liverpool" width="120" height="150">
    </div>
    <div id ="header"> 
        <h1> City Soldiers </h1>
        <h2> Question 1</h2> 
        <p align="center">What is the answer?</p>
    </div>

    <div id ="maincontent" >   
        <div id ="buttons">
            <p> <button type="button" onClick="correct()"> A </button> </p>
            <p> <button type="button"> B </button> </p>
            <p> <button type="button"> C </button> </p>
            <p> <button type="button"> D </button> </p>
            <p> 
                <a href="PickaQuestionCS.html">
                    <button type="button"> Go Back </button>
                </a>
            </p>
        </div>
    </div>
    <div id="footer">
        <p>&nbsp;</p>
        <p>&nbsp;</p>
    </div>

</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

使用不同网页上的值,您很可能会使用查询字符串 Cookie ,或从数据库检索图像路径, json xml