Wednesday, July 11, 2012

getElemntById query for JavaScript



can you please tell me why this wouldnt work? been stuck at it all day.


I just wanna copy whatever is enetered in the first field, convert it to a variable and project it to the last


field.


Thank you


ps: needless to say i only copied the relevant bits of the code…



<th bgcolor=\"#eeeee\" width=12.5%>Monday</th>
<th bgcolor=\"#eeeee\" width=12.5%><input id=\"test\" value=\"09:15\" size=15></td></th>
<th bgcolor=\"#eeeee\" width=12.5%><input type=time id=\"Monday_Breakfast_LastSeating\" value=\"11:45\" size=15></td></th>

</form>
</table>

<form id=\"form2\" id=other method=POST>




<tr>
<td bgcolor=\"#aaeeaa\"align=center><button onclick=\"myFunction()\">Calculate</button></td>

</tr>

</form>


<table width=40% border=0>

<th bgcolor=\"#eeaaaa\" align=center width=33%>Goal</th>

</table>

<form id=result method=POST>
<table width=40% border=0>

<th style=\"border:black;\" bgcolor=\"#eeaaaa\" align=center><em></em> <p id=\"calculation2\" size=15>N/A</p></th>
<th bgcolor=\"#eeaaaa\" align=center><em></em> <p id=\"calculation3\" size=15>N/A</p></th>
<th bgcolor=\"#eeaaaa\" align=center><p id=\"calc\" size=15>N/A</p></th>

</table>
</form>

<script type=\"text/javascript \">

function myFunction() {

var test = getElementById(\"test\").value;
document.getElementById(\"calc\").innerHTML = test;
}

</script>






Rating: 3 out of 5 based on 4 ratings


The post getElemntById query for JavaScript appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/getelemntbyid-query-for-javascript.html

No comments:

Post a Comment