Spanish Property - WoW Gold - WoW Gold - Online Advertising - Anime Downloads

PDA

View Full Version : Combine 2 Script that will work together..


b007
Sep 1st 2008, 10:53 am
Hi,
I got a validation script and a confirm script,
I want that if the validation return false than no to do the confirm func.
just return a msg in the lable text as it does.
and if the validation return true than do the confirm func.
and if I press on ok at the confirm than return true , cancel return false.
My 2 Scripts are:

function Validate()
{
var radiobuttonList = document.getElementsByName("MyRadioButton1");
var isSelected = false;
for( i=0; i<radiobuttonList.length;i++)
{
if (radiobuttonList[i].checked)
{
isSelected = true;
}
}
if(!isSelected)
document.getElementById("lblTEXT1").innerText = "Must select a row";

return isSelected;
}
--------------
function confirmDelete()
{
var answer = confirm("?are u sure")
if (answer)
{
alert("msg delete");
return true;
}
else
{
alert("msg not delete");
return false;
}
}

How to do that?
Thanks, Gil

Sleeping Troll
Sep 2nd 2008, 10:13 am
if (radiobuttonList[i].checked.value=(value))
Checked is a property of the radio button which contains the value it is to have when checked.

<input TYPE="radio" checked="on">

If the radio button is selected it will return a value of "on"