I have some pages that a client has requested be changed from using forms to use Master Pages. Some of these pages have textboxes for phone numbers that are using javascript with onpropertchange events to determine when the user has typed 3 characters into them and they then move the cursor to the next textbox. Now that I'm going to be using Master Pages and Content pages how can I get this javascript to work? Below is the original javascript:
<SCRIPT language="javascript" event="onpropertychange" for="txtWPhone1">
if ( event.propertyName == "value" && Form1.txtWPhone1.value.length >= 3 )
{
Form1.txtWPhone2.focus();
Form1.txtWPhone2.select();
}
</SCRIPT>
I've tried making adding the script to the page on the PageLoad of the content page like so:
Dim onloadScript As New System.Text.StringBuilder()
onloadScript.Append("<SCRIPT language='javascript' event='onpropertychange' for='txtWPhone1'>")
onloadScript.Append(vbCrLf)
onloadScript.Append("if ( event.propertyName == 'value' && form1.txtWPhone1.value.length >= 3 )")
onloadScript.Append(vbCrLf)
onloadScript.Append("{")
onloadScript.Append(vbCrLf)
onloadScript.Append("form1.txtWPhone2.focus();")
onloadScript.Append(vbCrLf)
onloadScript.Append("form1.txtWPhone2.select();")
onloadScript.Append(vbCrLf)
onloadScript.Append("}")
onloadScript.Append(vbCrLf)
onloadScript.Append("</SCRIPT>")
Me.ClientScript.RegisterStartupScript(Me.GetType(), "onLoadCall", onloadScript.ToString())
But this isn't working either. I'm sure my problem is with the onpropertychange event in the script tag or with how the page knows which control I'm referring to but I can't figure out what I need to change. Any help would be greatly appreciated!!
-Marshall-
-InfiNet Development Inc.-