Skip to content

Commit

Permalink
More dynamic and also alerty
Browse files Browse the repository at this point in the history
  • Loading branch information
Citronnelle committed Sep 9, 2019
1 parent 309879c commit d56c47c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 75 deletions.
6 changes: 3 additions & 3 deletions webApp/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<section name="products">
<table>
<tr>
<td><a href="prod1.html"><img src="prod1.jpg"></a><br />100€<br />Kana</td>
<td><a href="prod2.html"><img src="prod2.jpg"></a><br />15€<br />Sulg</td>
<td><a href="prod3.html"><img src="prod3.jpg"></a><br />40€<br />Muna</td>
<td><a href="view.html?name=Kana&price=100&file=kana"><img src="kana.jpg"></a><br />100€<br />Kana</td>
<td><a href="view.html?name=Sulg&price=15&file=sulg"><img src="sulg.jpg"></a><br />15€<br />Sulg</td>
<td><a href="view.html?name=Muna&price=40&file=muna"><img src="muna.jpg"></a><br />40€<br />Muna</td>
</tr>
</table>
</section>
Expand Down
24 changes: 0 additions & 24 deletions webApp/web/prod1.html

This file was deleted.

24 changes: 0 additions & 24 deletions webApp/web/prod2.html

This file was deleted.

24 changes: 0 additions & 24 deletions webApp/web/prod3.html

This file was deleted.

39 changes: 39 additions & 0 deletions webApp/web/view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ciphy's First Web Store</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
var urlStr = window.location.href;
var searchParams = new URL(urlStr);

var prodFileName = url.searchParams.get("file");
var prodName = url.searchParams.get("name");
var prodPrice = url.searchParams.get("price");

window.onload = function () {
var fileName = prodFileName + ".jpg";

document.getElementById("prodImage").src = fileName;
document.getElementById("prodName").innerText = prodName;
document.getElementById("prodPrice").innerText = prodPrice;

alert(prodName, prodPrice, fileName);
}
</script>
</head>

<body>
<header>
<a href="index.html" class="left"><img src="logo.jpg"></a>
<input class="right" type="button" name="login" value="Log in / Sign Up">
<input class="right" type="button" name="cart" value="Cart">
</header>
<section name="view">
<img id="prodImage">
<br /><span id="prodPrice" />
<br /><span id="prodName" />
</section>
</body>
</html>

0 comments on commit d56c47c

Please sign in to comment.