The method by which the js script gets the webform server control

  • 2020-03-30 02:59:54
  • OfStack

Net webform to get the server control,js script to get the server control needs to use ClientID

Web foreground acquisition control:
< % % = TextBox1. The ClientID > The control ID for TextBox1 is printed
Get the webform control in the js script :(implements the control to become red when the mouse moves over it)
<script type="text/javascript"> 
function myFuntion() 
document.getElementById('<%=TextBox1.ClientID %>').onmouseover=function(){'red'; 

Related articles: