hi ,
I have written a javascript function like this.
[CODE=javascript] function call(frm)
{
var loc_name = document.frm.lo ca.value;
//alert('<'+loc_n ame+'>');
//var objRegExp = /^(\s*)(\b[\w\W]*)/;
//if(objRegExp.te st(loc_name)) {
//alert("got it");
//loc_name = loc_name.replac e(objRegExp, '$2'); }
if(loc_name=='' || loc_name==' ' || loc_name==' ' || loc_name==' ' || loc_name==' ' || loc_name==' ')
{
alert('Enter location');
}
else
{
var url="http://10.202.1.24/shiftscheduler/loca_save";
document.frm.ac tion=url;
document.frm.su bmit();
}
}
[/CODE]
Actually i am getting location value from a text box. I have used onmouse over function. When i have placed mouse on the button,
the function call is called. when i do not enter anything in the text field and just place the mouse over the button, i am getting alert boxes two times with message as "Enter location". Actually if i enter any text in the textbox then i need to send those value to other page. If i just place the mouse over the button without entering anything in the textfield, i have to get an alert message saying " Enter location" , only once. Could anybody tell me the reason y is it behaving like that.
Thanks,
pavan
I have written a javascript function like this.
[CODE=javascript] function call(frm)
{
var loc_name = document.frm.lo ca.value;
//alert('<'+loc_n ame+'>');
//var objRegExp = /^(\s*)(\b[\w\W]*)/;
//if(objRegExp.te st(loc_name)) {
//alert("got it");
//loc_name = loc_name.replac e(objRegExp, '$2'); }
if(loc_name=='' || loc_name==' ' || loc_name==' ' || loc_name==' ' || loc_name==' ' || loc_name==' ')
{
alert('Enter location');
}
else
{
var url="http://10.202.1.24/shiftscheduler/loca_save";
document.frm.ac tion=url;
document.frm.su bmit();
}
}
[/CODE]
Actually i am getting location value from a text box. I have used onmouse over function. When i have placed mouse on the button,
the function call is called. when i do not enter anything in the text field and just place the mouse over the button, i am getting alert boxes two times with message as "Enter location". Actually if i enter any text in the textbox then i need to send those value to other page. If i just place the mouse over the button without entering anything in the textfield, i have to get an alert message saying " Enter location" , only once. Could anybody tell me the reason y is it behaving like that.
Thanks,
pavan
Comment