How do I prevent my Link from disappearing??
When I click on the link, “Click Here”
It display, “Look At Me!!” but the link, “Click Here” is GONE
Is there a way to keep my link, “Click Here” from disappearing?
So when I click on the link, “Click Here” the content, “Look At Me!!” should display as well.
thanks
Here are my codes
<html>
<head>
<script type="text/javascript">
function display() {
document.writeln("Look At Me!!");
}
</script>
</head>
<body>
<a href="google.com" onClick="display()">Click Here</a>
</body>
</html>
useing document.write will create a new document that is replaced with the origional document (the one that contains the link).
The solution here would be append child or innerHTML changes
.innerHTML is used when you trigger an event but if you just want to display the text how would you go about do it??
I don’t want to used document.writeln because it will “Wipe out all the contents” of that page.
So I have some HTML text and javascript text. I would like both to display on my page.
Here’s my code
<html>
<head>
<script type="text/javascript">
function display() {
document.writeln("How do I make both text appear");
}
</script>
</head>
<body onload="display()">
I would like this text in the body to remain.
<script type="text/javascript">
display();
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
I would like this text in the body to remain.
<script>
window.onload = function() {
var currBody = document.body;
currBody.innerHTML = 'How do I make both text appear' + currBody.innerHTML;
};
</script>
</body>
</html>