Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a limitation for document.getElementById("").value?
    primarykey
    data
    text
    <p>I have written a code to read the value from many id's and display the value out when the button is pressed. However, the value cannot been display when it is press. I save the file as php but i need to use javascript for display the value of variable when button is press.Below is part of my code that causes it not working</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;...&lt;/title&gt; CSS code here &lt;/head&gt; &lt;body&gt; $senario_1=3; $senario_2=3; $senario_3=3; $senario_4=3; &lt;div id="content"&gt; &lt;p class="senario_1"&gt;Senario 1&lt;/p&gt; &lt;p class="senario_2"&gt;Senario 2&lt;/p&gt; &lt;p class="senario_3"&gt;Senario 3&lt;/p&gt; &lt;p class="senario_4"&gt;Senario 4&lt;/p&gt; &lt;input id="senario_1" class="senario_1" type="text" value="&lt;?php echo $senario_1 ?&gt;"/&gt; &lt;input id="senario_2" class="senario_2" type="text" value="&lt;?php echo $senario_2 ?&gt;"/&gt; &lt;input id="senario_3" class="senario_3" type="text" value="&lt;?php echo $senario_3 ?&gt;"/&gt; &lt;input id="senario_4" class="senario_4" type="text" value="&lt;?php echo $senario_4 ?&gt;"/&gt; &lt;script type='text/javascript'&gt; setTimeout(function() { window.location.reload(true); },60000); &lt;/script&gt; &lt;/div&gt; &lt;div id="menu"&gt; &lt;button onclick="refresh()" name="refresh" class="refresh"&gt;Refresh&lt;/button&gt; &lt;button onclick="senario_1()" name="senario_1" class="senario_1"&gt;Senario 1&lt;/button&gt; &lt;button onclick="senario_2()" name="senario_2" class="senario_2"&gt;Senario 2&lt;/button&gt; &lt;button onclick="senario_3()" name="senario_3" class="senario_3"&gt;Senario 3&lt;/button&gt; &lt;button onclick="senario_4()" name="senario_4" class="senario_4"&gt;Senario 4&lt;/button&gt; &lt;button onclick="reset()" name="reset" class="reset"&gt;Reset&lt;/button&gt; &lt;/div&gt; &lt;script type='text/javascript'&gt; function refresh() { document.getElementById("content").innerHTML=window.location.reload(true); } function senario_1() { document.getElementById("senario_1").value="&lt;?php echo $senario_1 ?&gt;"; } function senario_2() { document.getElementById("senario_2").value="&lt;?php echo $senario_2 ?&gt;"; } function senario_3() { document.getElementById("senario_3").value="&lt;?php echo $senario_3 ?&gt;"; } function senario_4() { document.getElementById("senario_4").value="&lt;?php echo $senario_4 ?&gt;"; } function reset() { document.getElementById("senario_1").value=""; document.getElementById("senario_2").value=""; document.getElementById("senario_3").value=""; document.getElementById("senario_4").value=""; } function refresh() { document.getElementById("content").innerHTML=window.location.reload(true); } function senario_1() { document.getElementById("top_left").value="&lt;?php echo $senario_1 ?&gt;"; } function senario_2() { document.getElementById("top_right").value="&lt;?php echo $senario_2 ?&gt;"; } function senario_3() { document.getElementById("bottom_left").value="&lt;?php echo $senario_3 ?&gt;"; } function senario_4() { document.getElementById("bottom_right").value="&lt;?php echo $senario_4 ?&gt;"; } function reset() { document.getElementById("top_left").value=""; document.getElementById("top_right").value=""; document.getElementById("bottom_left").value=""; document.getElementById("bottom_right").value=""; }&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload