* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
Path : /proc/self/cwd/ |
|
Current File : //proc/self/cwd/data_records.php |
<!-- page content -->
<style>
#container {
width: 600px;
margin: auto;
background-color: steelblue;
text-align: center;
}
.left {
float:left;
font-weight:bold;
width: 100px;
}
.label {
float:left;
width: 100px;
text-align:right;
}
.button {
border-radius: 12px;
background-color: lightsteelblue;
width: 120px;
}
</style>
<!-- page record data with static/beginning input -->
<div id="container">
<h1 id="title">Movie Title</h1>
<div class="label">Rated</div> <div class="left" id="rating">Rating</div>
<div class="label">Genre:</div><div class="left" id="genre">Genre</div>
<br style="clear:both">
<div class="label">Studio:</div> <div class="left" id="label">Studio</div>
<div class="label">Screen format:</div> <div class="left" id="screen">Screen</div>
<div class="label">Sound format:</div> <div class="left" id="audio">Audio</div>
<br style="clear:both"> <br>
<input type="button" id="prev" class="button" value="< < <">
<input type="button" id="next" class="button" value="> > >">
<br><br>
<div id="status">Displaying record X of Y.</div>
</div>
<!-- load array data, review js objects inside arrays -->
<!-- <script src="http://webdev.iyaclasses.com/~dent/json/array_data.js"></script> -->
<?php
$sql = "SELECT * from movieView WHERE genre='Comedy'";
include "sql_to_json.php";
// echo($json2);
?>
<script>
var movies = <?php echo $json2 ?>;
console.log(movies);
/* Test data
console.log(movies); console.log(movies[0]); console.log(movies[0].title);
*/
// what code would change values of the objects #title, #rating and #status?
// PAGE CODE
// set up counter variable (current record) i
// BUT note array index 0 will be record 1
var i = 9
var settitle = function(){
document.querySelector("#title").innerHTML = movies[i].title;
document.querySelector("#rating").innerHTML = movies[i].rating;
document.querySelector("#genre").innerHTML = movies[i].genre;
document.querySelector("#label").innerHTML = movies[i].label;
document.querySelector("#audio").innerHTML = movies[i].sound;
document.querySelector("#status").innerHTML = "Record " + (i+1) + " of " + movies.length ;
}
settitle();
document.querySelector("#next").addEventListener("click", function(){
i++;
if(i>movies.length-1) {
i=0;
}
settitle();
})
document.querySelector("#prev").addEventListener("click", function(){
i--;
if(i < 0) { i = movies.length - 1};
settitle();
})
</script>