Archive for August 2nd, 2007

On selection of radio button to change the value of drop down list

Thursday, August 2nd, 2007

<!– To define a radio button –>
<input type=”radio” name=”proptype” value=”Residential” onclick=”javascript:residential()” checked=”checked”>Residential

<input type=”radio” name=”proptype” value=”Commercial” onclick=”javascript:commercial()” “>Commercial
<select name=”propertytype”size=”1″>
<option value=”ResApartment”>Residential Apartment</option></select>
<!– Script code–>
function residential()
{
var drop=document.form1.propertytype;
drop.options.length = 0
drop.options[drop.options.length] = new Option (”Residential Apartment”);
drop.options[drop.options.length] = new Option (”Residential Land“);
}

function commercial()
{

var drop=document.form1.propertytype;
drop.options.length = 0
drop.options[drop.options.length] = new Option (”Commercial Shop”);
drop.options[drop.options.length] = new Option (”Commercial Office”);
}

Posted by Kalaivani S

To choose the value “Other” in the drop down list, to enable a textbox

Thursday, August 2nd, 2007

Use the following code snippet;

 

<!– To declare a dropdown–>

<select name=”country” id=”country” onChange=”findselected()”>

<!– To declare a textbox –>

<input name=”country1″ type=”text” value=”<?$_POST[country1]?>” id= “ocountry” disabled=”disabled”/>

< script code >

 

function findselected(){

        var country = document.getElementById(’country’);

        var ocountry = document.getElementById(’ocountry’);

        (country.value == “Other”)? ocountry.disabled=false : ocountry.disabled=true

        }

 

 


 

 

Posted by Kalaivani S

To define a button type as image

Thursday, August 2nd, 2007

To define a button type as “image “, some times it does not work in the POST method.

To overcome this problem to define a button like this,

<input type=”image” src=”images/go_search.jpg” name=”search[0]” value=”gosearch” />

<!– after submitting the button to call isset method like this–>

if(isset($_POST[search]))

{

}

Posted by Kalaivani S