0
   

Javascript problem with printing

 
 
Reply Thu 2 Apr, 2015 10:58 am
I want to know how to print the randomly selected text but I am unsure how. Here is the code.


<!DOCTYPE html>
<html>
<body>

<h1>JavaScript in Body</h1>
<button type="button" onclick="myFunction()">Click For New Adjective</button>

<p id="word">adjectives</p>

<script>

var description = [
"yayay",
"chicken",
"what",
"hey"
];

var size = description.length
var x = Math.floor(size*Math.random())
document.getElementById('word').src=description[x];
</script>

</body>
</html>
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 915 • Replies: 0
No top replies

 
 

Related Topics

MS Word 8.1 - Question by gollum
Best Photo Printer? - Question by kellynevers
printing problems - Question by Challie
One Note Margins - Question by Tobor
Printing - Question by gollum
 
  1. Forums
  2. » Javascript problem with printing
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 04/23/2024 at 12:03:19