\n\n\n Hi There!\n\n
\n \n \n","upvoteCount":5},"suggestedAnswer":[{"@type":"Answer","text":"Lord Krishna \nThank you , it works👍\n\nhttps://code.sololearn.com/W68C4rMyeW9j/?ref=app","upvoteCount":30},{"@type":"Answer","text":"Shudarshan Rai \nYes 😁\nbut why it just change first marquee tag ?\nis it possible to change all of scrollamount with using one input?","upvoteCount":27},{"@type":"Answer","text":"Shudarshan Rai \nThanks alot","upvoteCount":25},{"@type":"Answer","text":"Updated: applies to all elements AliR૯za \n1st Prompt for a user input\n2nd select all elements with querySelectorAll\n3rd loop through the nodelist with foreach then apply setAttribute to all elements\n\n//Javascript code\nthis.addEventListener(\"DOMContentLoaded\", boot) \n\nfunction boot(){\nvar inpt = prompt(\"enter a no\"),\n mar = document.querySelectorAll(\"marquee\")\n\nmar.forEach(function(node){\n node.setAttribute(\"scrollamount\", inpt) \n \n });\n\n}","upvoteCount":12},{"@type":"Answer","text":"here is in your code\n\nhttps://code.sololearn.com/WTubKb2MezAH/?ref=app","upvoteCount":3},{"@type":"Answer","text":"AliR૯za 👍👍\nIs this helped you 😁","upvoteCount":3},{"@type":"Answer","text":"AliR૯za you can by giving them different id","upvoteCount":2},{"@type":"Answer","text":"wow that's awesome 😍","upvoteCount":1}]} }
+ 31

How can receive a number from user and use it in html tag ?

for example for this html code input x(number) from user and use that in <marquee scrollamount="x"> <marquee> https://code.sololearn.com/WTDuxdOWF90F/?ref=app

2nd May 2018, 7:20 AM
AliR૯za
AliR૯za - avatar
9 Answers
+ 5
<head> <script> function ScrollAmount () { var marquee = document.getElementById ("myMarquee"); var input = document.getElementById ("amount"); marquee.scrollAmount = input.value; } </script> </head> <body> <marquee id="myMarquee" style="width:150px;" scrollamount="10">Hi There!</marquee> <br /> <input id="amount" type="text" value="20" /> <button onclick="ScrollAmount ();">Change scrollAmount!</button> </body>
2nd May 2018, 7:53 AM
Sudarshan Rai
Sudarshan Rai - avatar
M
2nd May 2018, 8:34 AM
AliR૯za
AliR૯za - avatar
+ 27
Shudarshan Rai Yes 😁 but why it just change first marquee tag ? is it possible to change all of scrollamount with using one input?
2nd May 2018, 8:10 AM
AliR૯za
AliR૯za - avatar
+ 25
Shudarshan Rai Thanks alot
2nd May 2018, 7:59 AM
AliR૯za
AliR૯za - avatar
+ 12
Updated: applies to all elements AliR૯za 1st Prompt for a user input 2nd select all elements with querySelectorAll 3rd loop through the nodelist with foreach then apply setAttribute to all elements //Javascript code this.addEventListener("DOMContentLoaded", boot) function boot(){ var inpt = prompt("enter a no"), mar = document.querySelectorAll("marquee") mar.forEach(function(node){ node.setAttribute("scrollamount", inpt) }); }
2nd May 2018, 8:01 AM
Lord Krishna
Lord Krishna - avatar
2nd May 2018, 7:57 AM
Sudarshan Rai
Sudarshan Rai - avatar
M
+ 3
AliR૯za 👍👍 Is this helped you 😁
2nd May 2018, 7:59 AM
Sudarshan Rai
Sudarshan Rai - avatar
M
+ 2
AliR૯za you can by giving them different id
2nd May 2018, 8:30 AM
Sudarshan Rai
Sudarshan Rai - avatar
M
+ 1
wow that's awesome 😍
5th May 2018, 7:15 AM
Explore Further
Explore Further - avatar