Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

TUTORIAL: Changing text with buttons
Started by squirtle2016
(2016-03-10 22:04:12)
squirtle2016 (2016-03-10 22:04:12)
This is a tutorial, do not close this.

This is how to make text change with buttons. First, type this code in:

<html>
<head>
<title>Changing text with buttons</title>
<script>

</script>
</head>
<body>

</body>
</html>

Once you have this done, add this in the <script></script> tags:

function changeText() {document.getElementById('text').innerHTML='This is new text.'}

Next, add this in the <body></body> tags:

<div id='text'>This is old text.</div>
<button style='button' onClick='javascript:changeText();'>Change the text!</button>

That's it! Now save the page, and test it. Hope this helps!

This post has been edited one or more times, the last time was:
2016-03-10 22:05:03

Stop, or you die.
Jill (2016-03-10 22:07:31)
Nice.

Gumball (2016-03-13 16:37:49)
Obvious is obvious.
jdhs7 (2016-03-14 21:06:29)
Gee thanks for the unuseful javascript tutorial
If you're looking for music with watered down lyrics, I promise that you need to go somewhere else
And if you want somebody to tell you everything that you wanna hear I won't be any help
TwilightWinter (2016-05-31 19:51:53)
It is funny how some people start to teach something the minute they starting learning it.
‚úč
NodePoint (2016-06-01 04:18:00)
Tip: avoid using the incorrect case for HTML attributes. A noticeable example here would be 'onClick' when it should be all lowercase as 'onclick'. This is to avoid any breakages in browsers that would be case sensitive about HTML attributes and so that it is done properly.
Pentester, web developer, artist, and tech enthusiast.
My site
MarioErmando (2016-06-03 09:03:35)
it's 2016 andre
NodePoint (2016-06-03 22:46:12)
ik bby but you know
Pentester, web developer, artist, and tech enthusiast.
My site
 

Log in to submit a comment

This topic's ID: 82321

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Total registered users: 7758
New registered users today: 0
Newest registered user: Yeetus

©  Copyright 2018 3DSPlaza. All Rights Reserved