I am posting this since most of the Regular Expressions I got from the NET where not working on
non-IE browsers..
function validate()
{
if (document.Form1.TextBox1.value!='')
{
var urlRegxp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
var url = document.Form1.TextBox1.value
if(urlRegxp.test(url) != true)
{
alert('Please enter a valid External URL');
document.Form1.TextBox1.focus();
return false;
}
}
}
Cheers
Rajesh Sivaraman.
Wednesday, August 30, 2006
Friday, August 18, 2006
Setting focus to a textbox from codebehind
Dim fun As String
fun = fun & "Script language='javascript'" & vbCrLf
fun = fun & "function setFocus() {" & vbCrLf
fun = fun & "document.getElementById('txtDomainName').focus();" & vbCrLf
fun = fun & "}" & vbCrLf
fun = fun & "window.onload = setFocus;" & vbCrLf
fun = fun & "/Script" & vbCrLf
RegisterClientScriptBlock("Focus", fun)
On the 2nd and 7th lines above provide angle brackets "<" or ">" accordingly as blogger is not allowing me to post like as it is ;-)
fun = fun & "Script language='javascript'" & vbCrLf
fun = fun & "function setFocus() {" & vbCrLf
fun = fun & "document.getElementById('txtDomainName').focus();" & vbCrLf
fun = fun & "}" & vbCrLf
fun = fun & "window.onload = setFocus;" & vbCrLf
fun = fun & "/Script" & vbCrLf
RegisterClientScriptBlock("Focus", fun)
On the 2nd and 7th lines above provide angle brackets "<" or ">" accordingly as blogger is not allowing me to post like as it is ;-)
Subscribe to:
Posts (Atom)