Wednesday, 25 July 2012

DTD Code

<!DOCTYPE NEWSPAPER [
<!ELEMENT NEWSPAPER (ARTICLE+)>
<!ELEMENT ARTICLE (HEADLINE,BYLINE,LEAD,BODY,NOTES)>
<!ELEMENT HEADLINE (#PCDATA)>
<!ELEMENT BYLINE (#PCDATA)>
<!ELEMENT LEAD (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
<!ELEMENT NOTES (#PCDATA)>
<!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED>
<!ATTLIST ARTICLE EDITOR CDATA #IMPLIED>
<!ATTLIST ARTICLE DATE CDATA #IMPLIED>
<!ATTLIST ARTICLE EDITION CDATA #IMPLIED>
]>

MySQL Updating Code

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Id And Class Selector

The id Selector

The id selector is used to specify a style for a single, unique element.
The id selector uses the id attribute of the HTML element, and is defined with a "#".
The style rule below will be applied to the element with id="para1":
#para1
{
text-align:center;
color:red;
}

The class Selector

The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.
This allows you to set a particular style for many HTML elements with the same class.
The class selector uses the HTML class attribute, and is defined with a "."
In the example below, all HTML elements with class="center" will be center-aligned:
.center {text-align:center;}

CSS Basic Code

body
{
background-color:#d0e4fe;
}
h1
{
color:orange;
text-align:center;
}
p
{
font-family:"Times New Roman";
font-size:40px;
}

Thursday, 19 July 2012

Ajax DataBase Create Code

<html>
<head>
<script type="text/javascript">
function showCustomer(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getcustomer.asp?q="+str,true);
xmlhttp.send();
}
</script>
</head
<body>
<form>
<select name="customers" onchange="showCustomer(this.value)">
<option value="">Select a name:</option>
<option value="Ali">Ali</option>
<option value="Ahmed ">Ahmed</option>
<option value="Zain">zain</option>
</select>
</form>
<br />
<div id="txtHint">Customer info will be listed here...</div>
</body>
</html>

Sunday, 15 July 2012

Java Print Code

class HelloWorldApp {
 public static void main(String[] args) {
 System.out.println("Hello World!"); // Display the string.
 }
}

Tuesday, 10 July 2012

For Loop Code

for (variable=startvalue;variable<endvalue;variable=variable+increment)
  {
  code to be executed
  }
Example
for (i=0; i<5; i++)
  {
  x=x + "The number is " + i + "<br />";
  }

Arry Code

var car1="Saab";
var car2="Volvo";
var car3="BMW";
ar myCars=new Array(); // regular array (add an optional integer
myCars[0]="Saab";       // argument to control array's size)
myCars[1]="Volvo";
myCars[2]="BMW";
2:
var myCars=new Array("Saab","Volvo","BMW"); // condensed array
3:
var myCars=["Saab","Volvo","BMW"]; // literal array

If&Else Condition Codes

if (condition)
  {
  code to be executed if condition is true
  }
else
  {
  code to be executed if condition is not true
  }

if (time<20)
  {
  x="Good day";
  }
else
  {
  x="Good evening";
  }

Friends