Hello & Thanks ;
Trouble spots:
- input type=“button” onclick=“countTmesClicked()” value=“countTmesClicked”
- function countTmesClicked ()
<!DOCTYPE html>
<html lang="en">
<head>
<title>VM file:///C:/Users/vmars/Desktop/myPrograms/HeyBuddy/~~Hey-Buddy-WIP/Attributes.html </title>
<style>
body {
margin:0;
padding:0;
font-family: Sans-Serif;
line-height: 1.5em;
}
</style>
</head>
<body onload= "loadGlobalConstants()" >
<p id="currentPage" align="center">Current Page</p>
<script>
function loadGlobalConstants() {
var LogArea = "LogArea";
var p_tgh;
var document_URL;
var button_Url ;
var timesClicked = 0;
documentURL()
}
</script>
<script>
function documentURL() {
var document_URL = document.URL;
document.getElementById("currentPage").innerHTML = document_URL;
// document.getElementById("LoadButtonLink").innerHTML = document_URL;
// alert(button_Url);
}
</script>
<script>
function countTmesClicked() {
alert(timesClicked);
if (timesClicked == 0)
{
document.write(timesClicked);
timesClicked = timesClicked+1;
}
if (timesClicked > 0)
{
timesClicked = timesClicked+1;
document.write(timesClicked)
}
</script>
<div>
<img src="file:///C:/Users/vmars/Desktop/myPrograms/HeyBuddy/~~Hey-Buddy-WIP/smallCartoonShark.png">
<!-- get current page address -->
</div>
<div>
<!-- Buttons Header createNewLink -->
<button onclick="fiddleWithHasAttribute()">fiddleWithHasAttribute</button>
<button onclick="fiddleWithGetAttribute()">fiddleWithGetAttribute</button>
<button onclick="fiddleWithRemoveAttribute()">fiddleWithRemoveAttribute</button>
<input type="button" onclick="documentURL()" value="Reload Page" />
<input type="button" onclick="countTmesClicked()" value="countTmesClicked" />
</div>
<div class="innertube"> <!-- div.section.content.innertube.p -->
<p contenteditable id="p_tgh">Text paragraph</p>
</div>
</body>
<script id="js" >
const img = document.querySelector('img');
var var_hasAttribute ;
function fiddleWithHasAttribute() {
var_hasAttribute = img.getAttribute('src'); // returns "...shark.png"
alert(var_hasAttribute);
createTextArea();
}
</script>
<script id="js" >
var var_getAttribute ;
function fiddleWithGetAttribute() {
var_getAttribute = img.getAttribute('src'); // returns "...shark.png"
alert(var_getAttribute);
}
</script>
<script id="js" >
var var_removeAttribute ;
function fiddleWithRemoveAttribute() {
var_removeAttribute = img.removeAttribute('src'); // remove the src attribute and value
alert(var_removeAttribute);
}
</script>
<script id="js" contenteditable >
function createTextArea() {
p_tgh = document.createElement("p");
p_tgh.innerHTML = TextParagraph;
p_tgh.setAttribute("contenteditable", "true");
var content = document.getElementById("content");
content.appendChild(p_tgh);
}
</script>
</html>
Also , I can’t get alert() to work in that function .
Thanks for your help !