JavaScript document.getElementById

If you want to quickly access the value of an HTML input give it an id to make your life a lot easier.
This small script below will check to see if there is any text in the text field "myText". The argument that getElementById requires is the id of the HTML element you wish to utilize



<script defer="defer" type="text/javascript">

function notEmpty()

{

var myTextField = document.getElementById('myText');

if(myTextField.value != "")

alert("You entered: " + myTextField.value)

else

alert("Would you please enter some text?")

}

</script>

<input type='text' id='myText' />

<input type='button' onclick='notEmpty()' value='Form Checker' />





Difference between Abstraction and Encapsulation

Abstraction:

It is virtual class design.
Representation of data that how we represent it.
Before actually defining class developer will think about about the properties, methods and events will be there in class.

Encapsulation:

Hiding of unnecessary data.
At the time of class definition developers will think about which should display to end user and which should not.

Conclusion:
Abstraction is collection of data and Encapsulation is exposure of data in appropriate access specifier.

Difference between Rule and Check Constraint

Check Constraint:

Check constraint is associated with columns in a Table. So these can't be re-used.

Suppose if "Emp" table having the coulmn "Salary" then
alter table Emp add constraint ck_op Check (Salary between 15000 and 45000)

Rule:

Rules are defined with in a database and can be applied to any number of columns.
Creating Rule:
CREATE RULE SAL_RANGE
as
@Sal > 15000 and @Sal > 45000
Binding Rule to a Column:
SP_BINDRULE 'SAL_RANGE','Emp.Salary'