let a = "The Wolf Spider";
function setAction(){
addEventListener("click", function() {
document.querySelector(".crusher").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".crusherDiv").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".readySetEverest").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".aboutUs").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".gallery").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".contactUs").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".footer").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector(".svgthree").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector("aside").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector("article").style.visibility="hidden";
});
addEventListener("click", function() {
document.querySelector("body").style.backgroundRepeat = "repeat-x";
});
addEventListener("click", function() {
document.querySelector("body").style.height ="1000px";
});
addEventListener("click", function() {
document.querySelector("body").style.width ="1000px";
});
addEventListener("click", function() {
document.querySelector("header").innerHTML=a;
});
addEventListener("click", function() {
document.querySelector("header").style.font = "200 35px/1.3 'Oleo Script', Helvetica, sans-serif";
});
addEventListener("click", function() {
document.querySelector("header").style.color = "#2b2b2b";
});
addEventListener("click", function() {
document.querySelector("header").style.textShadow = "4px 4px 0px rgba(0,0,0,0.1)";
});
addEventListener("click", function() {
document.querySelector("header").style.backgroundColor="white";
});
addEventListener("click", function() {
document.querySelector(".logo").style.transform = "scale(.5)";
});
addEventListener("click", function() {
document.querySelector(".logo").style.left="99%";
});
addEventListener("click", function() {
window.scrollTo(10, 10);
});
var hyperLinkOne = document.createElement("a");
hyperLinkOne.innerHTML = "";
document.body.appendChild(hyperLinkOne);
hyperLinkOne.setAttribute('href', 'spiderseteverest.php');
hyperLinkOne.className="hyperOne";
var b2c = document.createElement("BUTTON");
b2c.innerHTML = "Back To Center Page";
document.body.querySelector(".hyperOne").appendChild(b2c);
b2c.className = "backToCenterPage";
b2c.style.position="absolute";
b2c.style.top = "25%";
b2c.style.left= "75%";
document.querySelector(".backToCenterPage").style.height="200px";
document.querySelector(".backToCenterPage").style.width="200px";
document.querySelector(".backToCenterPage").style.color="green";
document.querySelector(".backToCenterPage").style.backgroundColor="black";
var hyperLinkTwo = document.createElement("a");
hyperLinkTwo.innerHTML = "";
document.body.appendChild(hyperLinkTwo);
hyperLinkTwo.setAttribute('href', 'simpleblog.php');
hyperLinkTwo.className="hyperTwo";
var randSpin = document.createElement("BUTTON");
randSpin.innerHTML = "Random Spider";
document.body.querySelector(".hyperTwo").appendChild(randSpin);
randSpin.className = "RandomSpin";
randSpin.style.position="absolute";
randSpin.style.top = "55%";
randSpin.style.left= "75%";
document.querySelector(".RandomSpin").style.height="200px";
document.querySelector(".RandomSpin").style.width="200px";
document.querySelector(".RandomSpin").style.color="green";
document.querySelector(".RandomSpin").style.backgroundColor="black";
addEventListener("click", function() {
document.querySelector(".RandomSpin").style.font = "200 35px/1.3 'Oleo Script', Helvetica, sans-serif";
});
addEventListener("click", function() {
document.querySelector(".RandomSpin").style.color = "green";
});
addEventListener("click", function() {
document.querySelector(".RandomSpin").style.textShadow = "1px 2px 0px green";
});
addEventListener("click", function() {
document.querySelector(".backToCenterPage").style.font = "200 35px/1.3 'Oleo Script', Helvetica, sans-serif";
});
addEventListener("click", function() {
document.querySelector(".backToCenterPage").style.color = "green";
});
addEventListener("click", function() {
document.querySelector(".backToCenterPage").style.textShadow = "1px 2px 0px green";
});
addEventListener("click", function() {
document.querySelector(".backToCenterPage").style.textShadow = "1px 2px 0px green";
});
}
//Spider Generator button//
function generateSpider(){
document.querySelector(".article-feed").innerHTML = "7";
var randomSpiderButton01 = document.createElement("BUTTON");
randomSpiderButton01.innerHTML = "Next Spider";
document.body.querySelector(".article-feed").appendChild(randomSpiderButton01);
randomSpiderButton01.className = "randomSpiderButton01";
randomSpiderButton01.style.position="absolute";
randomSpiderButton01.style.top = "25%";
randomSpiderButton01.style.left= "75%";
//create spider definition box//
var RandomSpiderDefinition = document.createElement("div");
RandomSpiderDefinition.innerHTML = "9";
document.body.querySelector(".article").appendChild(RandomSpiderDefinition);
RandomSpiderDefinition.className = "RandomSpiderDefinition";
RandomSpiderDefinition.style.position="absolute";
RandomSpiderDefinition.style.top = "25%";
RandomSpiderDefinition.style.left= "75%";
addEventListener("click", function() {
var SpiderImageBox = document.createElement("img");
document.body.querySelector(".article-feed").appendChild(SpiderImageBox);
SpiderImageBox.className = "SpiderImageBox";
SpiderImageBox.src = "";
SpiderImageBox.alt = "hummmm";
SpiderImageBox.style.position = "absolute";
SpiderImageBox.style.top = "55%";
SpiderImageBox.style.left="5%";})
}
.main{
box-sizing: border-box;
position: absolute;
margin: 0px;
border: 5px solid green;
padding: 0px;
height: 900px;
width: 1200px;
font-family: coniferous, sans-serif;
font-style: normal;
font-weight: 300;
background-repeat:no-repeat;
}
header{
box-sizing: border-box;
position: absolute;
top: 200px;
left: 230px;
border: 3px solid green;
padding: 0px;
height: 200px;
width: 600px;
font-family: coniferous, sans-serif;
font-style: normal;
font-size: 70px;
font-weight: 300; }
.SpiderClassification{position: absolute;
top: 13%;
left: 100%;}
aside{
box-sizing: border-box;
position: absolute;
top: 200px;
left: 10px;
border: 5px solid green;
padding: 0px;
height: 600px;
width: 200px;
font-family: coniferous, sans-serif;
font-style: normal;
font-size: 2em;
font-weight: 300; }
li{list-style-type: none;}
article{
box-sizing: border-box;
position: absolute;
top: 400px;
left: 250px;
border: 3px solid green;
padding: 0px;
height: 400px;
width: 560px;
font-family: coniferous, sans-serif;
font-style: normal;
font-size: 30px;
font-weight: 300; }
.article-feed{
box-sizing: border-box;
position: absolute;
top: 0px;
left: 0px;
border: 3px solid green;
padding: 0px;
height: 200px;
width: 280px;
font-family: coniferous, sans-serif;
font-style: normal;
font-size: 30px;
font-weight: 300; }
footer{
box-sizing: border-box;
position: absolute;
top: 800px;
left: 230px;
border: 3px solid green;
padding: 0px;
height: 106px;
width: 600px;
font-family: coniferous, sans-serif;
font-style: normal;
font-size: 30px;
font-weight: 300; }
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
.main{background-color: aliceblue}
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
.main{background-color: antiquewhite}
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
.main{background-color:aqua}
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
.main{background-color: aquamarine}
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
.main{background-color: azure;}
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
.main{background-color: beige;}
}
/* iPad 3 (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio : 2),
only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (min-resolution: 192dpi) {
.main{background-color: darkseagreen}
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
.main{background-color: darkgoldenrod;}
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
.main{background-color: darkred;}
}
/* Retina displays ----------- */
@media only screen
and (-webkit-min-device-pixel-ratio : 2),
only screen
and (min-resolution: 192dpi) {
.main{background-color: firebrick}
}
<?php require_once('spiderseteverestconnect.php'); ?>
<?php
$query = "SELECT spider, definition FROM wolf_spidertbl";
$recordset = mysqli_query($con, $query) or die(mysql_error($con));
$count = mysqli_num_rows($recordset);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="../CSS/SimpleBlog.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- SITEMAP -->
<div class="main">
<header class="header" style="color: green">Random Spider Archive Generator</header>
<aside class="aside">
<p style="text-align: center; color: green">Links</p>
<ul style="list-style: square">
<a style="text-decoration: none;" href="ReadySetEverestWebsite.php">
<li>Readys Set Everest</li>
</a>
<br>
<a style="text-decoration: none;" href="SpiderSetEverest.php">
<li>Spider Set Everest</li>
</a>
<br>
<a style = "text-decoration: none;"href="donationportal.php">
<li>Donation Portal for Ready Set Everest</li></a>
<br>
<a style = "text-decoration: none;" href="https://66a8090b7e6cb64f2254b14c7f6a4d3a.blogspot.com">
<li>Blogger for RSE.inc</li>
</a>
</ul>
</aside>
<article class="article">
<section class="main-section">
<section style="color: green" class="article-feed">
<button onClick="generateSpider()">Practice</button>
</section>
<section class="SpiderClassification">
<table class="table table-responsive">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">A</th>
<th scope="col">B</th>
<th scope="col">C</th>
</tr>
</thead>
<tbody>
whats up with this
<tr>
<th scope="row">2</th>
<td id="a2">a2</td>
<td id="b2">b2</td>
<td id="c2">c2</td>
</tr>
</tbody>
</table>
</section>
</section>
</article>
<footer style="color:green" class="footer">
<nav>Site Map</nav>
</footer>
</div>
<script type="text/javascript" src="../JavaScript/SimpleBlog.js"></script>
</body>
</html>
<?php
mysqli_free_result ($recordset);
mysqli_close ($con);
?>
I would like to inject php code into the javascript document so that when I press the Practice button, i can bring in data from a database. Can I do this by putting php directly into the innerhtml for "randomspider definition" at the bottom of the javascript document? I tried to inject php directly but i received an error that it was correct javascript.