Notes of Add on Content of Labs

Embed Size (px)

Citation preview

  • 8/8/2019 Notes of Add on Content of Labs

    1/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Lab: C and Data Structures

    * Write C program that implement the following sorting methods to sort a given list of integers inascending order:ii) Merge sort */

    #include #include

    #define MAX_ARY 10

    void merge_sort(int x[], int end, int start);

    int main(void) {int ary[MAX_ARY];int j = 0;

    printf("\n\nEnter the elements to be sorted: \n");for(j=0;j

  • 8/8/2019 Notes of Add on Content of Labs

    2/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    for(j = 0; j < size; j++)executing[j] = x[end + j];

    mrg1 = 0;

    mrg2 = mid - end + 1;

    for(j = 0; j < size; j++) {if(mrg2

  • 8/8/2019 Notes of Add on Content of Labs

    3/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    * Write C programs that implement Queue (its operations) using ii) Pointers */

    #define true 1#define false 0

    #include#include#include

    struct q_point{

    int ele;struct q_point* n;

    };

    struct q_point *f_ptr = NULL;

    int e_que(void);

    void add_ele(int);int rem_ele(void);void show_ele();

    /*main function*/void main(){

    int ele,choice,j;while(1){clrscr();printf("\n\n****IMPLEMENTATION OF QUEUE USING POINTERS****\n");printf("==============================================");

    printf("\n\t\t MENU\n");printf("==============================================");printf("\n\t[1] To insert an element");printf("\n\t[2] To remove an element");printf("\n\t[3] To display all the elements");printf("\n\t[4] Exit");printf("\n\n\tEnter your choice:");scanf("%d", &choice);

    switch(choice){

    case 1:{

    printf("\n\tElement to be inserted:");scanf("%d",&ele);add_ele(ele);getch();break;

    }

    case 2:{

    if(!e_que())

    Page 3

  • 8/8/2019 Notes of Add on Content of Labs

    4/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    {j=rem_ele();printf("\n\t%d is removed from the queue",j);getch();

    }

    else{printf("\n\tQueue is Empty.");getch();

    }break;

    }

    case 3:show_ele();getch();break;

    case 4:

    exit(1);break;

    default:printf("\n\tInvalid choice.");getch();break;

    }

    }}

    /* Function to check if the queue is empty*/

    int e_que(void){

    if(f_ptr==NULL)return true;return false;

    }

    /* Function to add an element to the queue*/void add_ele(int ele){

    struct q_point *queue = (struct q_point*)malloc(sizeof(struct q_point));queue->ele = ele;queue->n = NULL;

    if(f_ptr==NULL)f_ptr = queue;else{struct q_point* ptr;ptr = f_ptr;for(ptr=f_ptr ;ptr->n!=NULL; ptr=ptr->n);

    ptr->n = queue;}

    }

    Page 4

  • 8/8/2019 Notes of Add on Content of Labs

    5/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    /* Function to remove an element from the queue*/int rem_ele(){

    struct q_point* queue=NULL;

    if(e_que()==false){int j = f_ptr->ele;queue=f_ptr;f_ptr = f_ptr->n;free (queue);return j;

    }else{printf("\n\tQueue is empty.");return -9999;

    }}

    /* Function to display the queue*/void show_ele(){

    struct q_point *ptr=NULL;ptr=f_ptr;if(e_que()){printf("\n\tQUEUE is Empty.");return;

    }else{

    printf("\n\tElements present in Queue are:\n\t");while(ptr!=NULL){

    printf("%d\t",ptr->ele);ptr=ptr->n;

    }}

    }

    Page 5

  • 8/8/2019 Notes of Add on Content of Labs

    6/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    /* Write C programs that implement stack (its operations) using ii) Pointers */

    #include#include

    struct st_point{int ele;struct st_point *l;

    }

    *t;int i;

    void push_ele(int j);int pop_ele();void display_ele();

    void main()

    {char choice,num1=0,num2=0;int i;while(1){clrscr();printf("======================================");printf("\n\t\t MENU ");printf("\n======================================");printf("\n[1] Using Push Function");printf("\n[2] Using Pop Function");printf("\n[3] Elements present in Stack");printf("\n[4] Exit\n");

    printf("\n\tEnter your choice: ");fflush(stdin);scanf("%c",&choice);

    switch(choice-'0'){

    case 1:{

    printf("\n\tElement to be pushed:");scanf("%d",&num1);push_ele(num1);break;

    }

    case 2:{

    num2=pop_ele(1);printf("\n\tElement to be popped: %d\n\t",num2);getch();break;

    }

    case 3:

    Page 6

  • 8/8/2019 Notes of Add on Content of Labs

    7/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    {printf("\n\tElements present in the stack are:\n\t");display_ele();getch();break;

    }

    case 4:exit(1);break;

    default:printf("\nYour choice is invalid.\n");break;

    }}

    }

    /*Inserting the elements using push function*/

    void push_ele(int j){

    struct st_point *m;m=(struct st_point*)malloc(sizeof(struct st_point));m->ele=j;m->l=t;t=m;return;

    }

    /*Removing the elements using pop function*/int pop_ele(){

    if(t==NULL){printf("\n\STACK is Empty.");getch();exit(1);

    }else{int i=t->ele;t=t->l;return (i);

    }return 0;

    }

    /*Displaying the elements */void display_ele(){

    struct st_point *pointer=NULL;pointer=t;while(pointer!=NULL){printf("%d\t",pointer->ele);

    Page 7

  • 8/8/2019 Notes of Add on Content of Labs

    8/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    pointer=pointer->l;}

    }

    Page 8

  • 8/8/2019 Notes of Add on Content of Labs

    9/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    /* Write a C program that uses functions to perform the following:i) Creating a Binary Tree of integersii) Traversing the above binary tree in preorder, inorder and postorder. */

    #include#include #include

    struct treenode{

    int ele;struct treenode *l_child, *r_child;

    };

    struct treenode *insert_node(struct treenode *t,int a);void TraverseInorder(struct treenode *t);void TraversePreorder(struct treenode *t);

    void TraversePostorder(struct treenode *t);

    /*main function*/void main(){

    struct treenode *root_node = NULL;int num,value;int choice;

    clrscr();

    printf("----------------------------------------------------\n");printf("\t\t\tMENU\n");

    printf("-----------------------------------------------------\n");printf("[1] Create a Binary Tree and Use Inorder Traversal\n");printf("[2] Create a Binary Tree and Use Preorder Traversal\n");printf("[3] Create a Binary Tree and Use Postorder Traversal\n");printf("-----------------------------------------------------\n");printf("Enter your choice:");scanf("%d",&choice);

    if(choice>0 & choice 0){printf("\n\nEnter the data value:");scanf("%d",&value);root_node = insert_node(root_node,value);

    }

    switch(choice){case 1:

    Page 9

  • 8/8/2019 Notes of Add on Content of Labs

    10/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    printf("\n\nBinary tree using Inorder Traversal : ");TraverseInorder(root_node);getch();break;

    case 2:printf("\n\nBinary tree using Preorder Traversal : ");TraversePreorder(root_node);getch();break;

    case 3:printf("\n\nBinary tree using Postorder Traversal : ");TraversePostorder(root_node);getch();break;

    default:printf("Invalid Choice");

    break;}

    }}/*end main*/

    /* Function to create a Binary Tree of integers data */struct treenode *insert_node(struct treenode *t,int a){

    struct treenode *temp_node1,*temp_node2;if(t == NULL){

    t = (struct treenode *) malloc(sizeof(struct treenode));

    if(t == NULL){

    printf("Value cannot be allocated.\n");exit(0);

    }t->ele = a;t->l_child=t->r_child=NULL;

    }else{

    temp_node1 = t;

    while(temp_node1 != NULL)

    { temp_node2 = temp_node1;if( temp_node1 ->ele > a)temp_node1 = temp_node1->l_child;elsetemp_node1 = temp_node1->r_child;

    }if( temp_node2->ele > a){temp_node2->l_child = (struct treenode*)malloc(sizeof(struct treenode));

    Page 10

  • 8/8/2019 Notes of Add on Content of Labs

    11/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    temp_node2 = temp_node2->l_child;if(temp_node2 == NULL){printf("Value cannot be allocated.\n");exit(0);

    }temp_node2->ele = a;temp_node2->l_child=temp_node2->r_child = NULL;

    }else{

    temp_node2->r_child = (struct treenode*)malloc(sizeof(struct treenode));

    temp_node2 = temp_node2->r_child;if(temp_node2 == NULL){printf("Value cannot be allocated.\n");exit(0);

    }

    temp_node2->ele = a;temp_node2->l_child=temp_node2->r_child = NULL;

    }}return(t);}

    /* Function for Traversing the binary tree in inorder. */void TraverseInorder(struct treenode *t){if(t != NULL){TraverseInorder(t->l_child);

    printf("%d\t",t->ele);in_order(t->r_child);

    }}

    /* Function for Traversing the binary tree in preorder. */void TraversePreorder(struct treenode *t){

    if(t != NULL){printf("%d\t",t->ele);TraversePreorder(t->l_child);TraversePreorder(t->r_child);

    }}

    /* Function for Traversing the binary tree in postorder. */void TraversePostorder(struct treenode *t){if(t != NULL){TraversePostorder(t->l_child);TraversePostorder(t->r_child);

    Page 11

  • 8/8/2019 Notes of Add on Content of Labs

    12/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    printf("%d\t",t->ele);}

    }

    Page 12

  • 8/8/2019 Notes of Add on Content of Labs

    13/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    LAB: UNIX Programming

    Write a C program that illustrates the creation of childprocess using fork system call. One process finds sum of

    even series and other process finds sum of odd series

    #include #include #include #include int main(){int i,n,sum=0;pid_t pid;system(clear);printf(Enter n value:);scanf(%d,&n)

    pid=fork();if(pid==0){printf(From child process\n);for(i=1;i

  • 8/8/2019 Notes of Add on Content of Labs

    14/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Write a C program that illustrates filelocking using semaphores.

    #include #include #include #include #define MAXBUF 100#define KEY 1216#define SEQFILE suhritfileint semid,fd;void my_lock(int);void my_unlock(int);union semnum{

    int val;struct semid_ds *buf;

    short *array;}arg;int main(]){

    int child, i,n, pid, seqno;char buff[MAXBUF+1];pid=getpid();if((semid=semget(KEY, 1, IPC_CREAT | 0666))= = -1){

    perror(semget);exit(1);

    }arg.val=1;

    if(semctl(semid,0,SETVAL,arg)

  • 8/8/2019 Notes of Add on Content of Labs

    15/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    {perror(write);exit(1);

    }sleep(1);

    my_unlock(fd);}}

    void my_lock(int fd){

    struct sembuff sbuf=(0, -1, 0);if(semop(semid, &sbuf, 1)= =0)

    printf(Locking: Resource\n);else

    printf(Error in Lock\n);}void my_unlock(int fd){

    struct sembuff sbuf=(0, 1, 0);

    if(semop(semid, &sbuf, 1)= =0)printf(UnLocking: Resource\n);

    elseprintf(Error in Unlock\n);

    }

    Page 15

  • 8/8/2019 Notes of Add on Content of Labs

    16/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    LAB: Object Oriented Programming

    Java StringBuffer Replace Example

    /*

    Java StringBuffer Replace Example

    This example shows how contents of java StringBuffer can be replaced using

    replace method of Java StringBuffer class.

    */

    public class JavaStringBufferReplaceExample {

    public static void main(String[] args) {

    //Create the StringBuffer object

    StringBuffer sb = new StringBuffer("Hello World");

    System.out.println("Original Text : " + sb);

    /*

    To replace the contents of Java StringBuffer use

    StringBuffer replace(int start, int end, String str) method.

    It replaces the content from StringBuffer string from start index

    to end - 1 index by the content of the String str.

    */

    sb.replace(0,5,"Hi");

    Page 16

  • 8/8/2019 Notes of Add on Content of Labs

    17/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    System.out.println("Replaced Text : " + sb);

    }

    }

    /*

    Output would be

    Original Text : Hello World

    Replaced Text : Hi World

    Page 17

  • 8/8/2019 Notes of Add on Content of Labs

    18/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Copy binary file using Streams

    /*

    Copy binary file using Streams

    This example shows how to copy a binary file using Java FileInputStream

    and FileOutputStream classes. If you want to copy text file use

    FileReader and FileWriter classes instead of FileInputStream and

    FileOutputStream classes.

    */

    import java.io.FileNotFoundException;

    import java.io.FileInputStream;

    import java.io.FileOutputStream;

    import java.io.IOException;

    public class CopyBinaryFile {

    public static void main(String[] args) {

    String strSourceFile="C:/FileIO/source.dat";

    String strDestinationFile="C:/FileIO/dest.dat";

    try

    {

    Page 18

  • 8/8/2019 Notes of Add on Content of Labs

    19/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    //create FileInputStream object for source file

    FileInputStream fin = new FileInputStream(strSourceFile);

    //create FileOutputStream object for destination file

    FileOutputStream fout = newFileOutputStream(strDestinationFile);

    byte[] b = new byte[1024];

    int noOfBytes = 0;

    System.out.println("Copying file using streams");

    //read bytes from source file and write to destination file

    while( (noOfBytes = fin.read(b)) != -1 )

    {

    fout.write(b, 0, noOfBytes);

    }

    System.out.println("File copied!");

    //close the streams

    fin.close();

    fout.close();

    }

    catch(FileNotFoundException fnf)

    Page 19

  • 8/8/2019 Notes of Add on Content of Labs

    20/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    {

    System.out.println("Specified file not found :" + fnf);

    }

    catch(IOException ioe)

    {

    System.out.println("Error while copying file :" + ioe);

    }

    }

    }

    /*

    Typical output would be

    Copying file using streams

    File copied!

    Page 20

  • 8/8/2019 Notes of Add on Content of Labs

    21/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Simple Java TreeMap example

    /*

    Simple Java TreeMap example

    This simple Java Example shows how to use Java TreeMap. It also describes how to

    add something to TreeMap and how to retrieve the value added from TreeMap.

    */

    import java.util.TreeMap;

    public class JavaTreeMapExample {

    public static void main(String[] args) {

    //create object of TreeMap

    TreeMap treeMap = new TreeMap();

    /*

    Add key value pair to TreeMap using,

    Object put(Object key, Object value) method of Java TreeMap class,

    where key and value both are objects

    put method returns Object which is either the value previously tied

    to the key or null if no value mapped to the key.

    */

    Page 21

  • 8/8/2019 Notes of Add on Content of Labs

    22/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    treeMap.put("One", new Integer(1));

    treeMap.put("Two", new Integer(2));

    /*

    Please note that put method accepts Objects. Java Primitive values CAN NOT

    be added directly to TreeMap. It must be converted to corrosponding

    wrapper class first.

    */

    //retrieve value using Object get(Object key) method of Java TreeMap class

    Object obj = treeMap.get("Two");

    System.out.println(obj);

    /*

    Please note that the return type of get method is an Object. The value must

    be casted to the original class.

    */

    }

    }

    /*

    Output of the program would be

    2

    Get lowest and highest key stored in Java TreeMap example

    Page 22

  • 8/8/2019 Notes of Add on Content of Labs

    23/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    /*

    Get lowest and highest key stored in Java TreeMap example

    This Java Example shows how to get the lowest and highest key stored in the java

    TreeMap object using firstKey and lastKey methods of java TreeMap class.

    */

    import java.util.TreeMap;

    public class GetLowestHighestKeyTreeMapExample {

    public static void main(String[] args) {

    //create TreeMap object

    TreeMap treeMap = new TreeMap();

    //add key value pairs to TreeMap

    treeMap.put("1","One");

    treeMap.put("3","Three");

    treeMap.put("2","Two");

    treeMap.put("5","Five");

    treeMap.put("4","Four");

    /*

    To get the lowest key currently stored in Java TreeMap use,

    Object firstKey() method of TreeMap class.

    Page 23

  • 8/8/2019 Notes of Add on Content of Labs

    24/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    This method returns the first or lowest key currently stored in the

    TreeMap object.

    */

    System.out.println("Lowest key Stored in Java TreeMap is : "

    + treeMap.firstKey());

    /*

    To get the highest key currently stored in Java TreeMap use,

    Object lastKey() method of TreeMap class.

    This method returns the last or highest key currently stored in the

    TreeMap object.

    */

    System.out.println("Highest key Stored in Java TreeMap is : "

    + treeMap.lastKey());

    }

    }

    /*

    Output would be

    Lowest key Stored in Java TreeMap is : 1

    Page 24

  • 8/8/2019 Notes of Add on Content of Labs

    25/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Highest key Stored in Java TreeMap is : 5

    */

    Page 25

  • 8/8/2019 Notes of Add on Content of Labs

    26/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    LAB: Operating Systems

    PROGRAM FOR OPTIMAL ALGORITHM

    #include

    #includeint fr[3];void main(){void display();int p[12]={2,3,2,1,5,2,4,5,3,2,5,2},i,j,fs[3];int max,found=0,lg[3],index,k,l,flag1=0,flag2=0,pf=0,frsize=3;clrscr();for(i=0;i

  • 8/8/2019 Notes of Add on Content of Labs

    27/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    }}

    }found=0;

    for(i=0;i

  • 8/8/2019 Notes of Add on Content of Labs

    28/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    no of page faults : 3

    Page 28

  • 8/8/2019 Notes of Add on Content of Labs

    29/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    PROGRAM FOR DEADLOCK

    #include#include

    void main(){int found,flag,l,p[4][5],tp,c[4][5],i,j,k=1,m[5],r[5],a[5],temp[5],sum=0;clrscr();printf("enter total no of processes");scanf("%d",&tp);printf("enter clain matrix");for(i=1;i

  • 8/8/2019 Notes of Add on Content of Labs

    30/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    {flag=0;break;}}

    if(flag==1){m[k]=i;k++;for(j=1;j

  • 8/8/2019 Notes of Add on Content of Labs

    31/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    PROGRAM FOR DEADLOCK DETECTION ALGORITHM

    #include

    #includevoid main(){int found,flag,l,p[4][5],tp,c[4][5],i,j,k=1,m[5],r[5],a[5],temp[5],sum=0;clrscr();printf("enter total no of processes");scanf("%d",&tp);printf("enter clain matrix");for(i=1;i

  • 8/8/2019 Notes of Add on Content of Labs

    32/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    if(c[i][j]>temp[j]){flag=0;break;}

    }if(flag==1){m[k]=i;k++;for(j=1;j

  • 8/8/2019 Notes of Add on Content of Labs

    33/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    LAB: Information Security

    Program implementing Monoalphabetic Cipher#include

    #include#include#includeint n;void main(){char a[1][50];int i,j,b[50];clrscr();cout

  • 8/8/2019 Notes of Add on Content of Labs

    34/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Program implementing Hill cipher#include#include#include

    #include#include#includeint c[3][1],k[3][3],l[3][3],p[3][1],i,j,m,n,o,b[3][3];int det;char d[1][10],e[1][10],a[1][26]={"abcdefghijklmnopqrstuvwxyz"};void main(){clrscr();cout

  • 8/8/2019 Notes of Add on Content of Labs

    35/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    m=k[0][0]*(k[1][1]*k[2][2]-k[1][2]*k[2][1]);n=k[0][1]*(k[1][0]*k[2][2]-k[1][2]*k[2][0]);o=k[0][2]*(k[1][0]*k[2][1]-k[2][0]*k[1][1]);det=m-n+o;

    b[0][0]=k[1][1]*k[2][2]-k[2][1]*k[1][2];b[0][1]=k[1][0]*k[2][2]-k[2][0]*k[1][2];b[0][2]=k[1][0]*k[2][1]-k[2][0]*k[1][1];

    b[1][0]=k[0][1]*k[2][2]-k[2][1]*k[0][2];b[1][1]=k[0][0]*k[2][2]-k[2][0]*k[0][2];b[1][2]=k[0][0]*k[2][1]-k[2][0]*k[0][1];

    b[2][0]=k[0][1]*k[1][2]-k[1][1]*k[0][2];b[2][1]=k[0][0]*k[1][2]-k[1][0]*k[0][2];b[2][2]=k[0][0]*k[1][1]-k[1][0]*k[0][1];for(i=0;i

  • 8/8/2019 Notes of Add on Content of Labs

    36/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Program implementing PlayFair Cipher#include#include#include

    #includeint i,j,n,n1,l,o=0;char k[3][25],m[5][5],c[1][26],p[1][26],a[4][26]={"abcdefghijklmnopqrstuvwxyz"};int b[26];void main(){clrscr();cout

  • 8/8/2019 Notes of Add on Content of Labs

    37/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    {for(j=0;j

  • 8/8/2019 Notes of Add on Content of Labs

    38/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Program implementing Port Checkimport java.net.*;import java.awt.event.*;import java.awt.*;

    import javax.swing.*;import java.io.*;class PortCheckFrame extends JFrame{JTextArea ta;PortCheckFrame(){super("checking ports");Container con=this.getContentPane();ta=new JTextArea(5,20);ta.setForeground(Color.red);setSize(300,300);con.add(new JScrollPane(ta));setVisible(true);

    String hostname=JOptionPane.showInputDialog("enter remote host name");ta.append("checking ports of"+hostname+"..\n");for(int i=0;i

  • 8/8/2019 Notes of Add on Content of Labs

    39/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    LAB: Web Technologies

    Program that Returns URL

    The full URL of this document is:

    document.write(document.URL);

    OUTPUT

    The full URL of this document is: http://www.w3schools.com/jsref/tryit_view.asp

    Page 39

    http://www.w3schools.com/jsref/tryit_view.asphttp://www.w3schools.com/jsref/tryit_view.asp
  • 8/8/2019 Notes of Add on Content of Labs

    40/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Program to Change Target attribute

    function changeTarget()

    {

    document.getElementById('w3s').target="_blank";

    }

    Visit google



    Try the link before and after you have pressed the button!

    Output

    Visit Google.com

    Page 40

  • 8/8/2019 Notes of Add on Content of Labs

    41/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Program to return the href of an area in an image-map

    Value of href attribute for Venus is:

    document.write(document.getElementById("venus").href);

    OUTPUT

    Value of href attribute for Venus is: http://www.Google.com/jsref/venus.htm

    Page 41

    http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_area_hrefhttp://www.google.com/jsref/venus.htmhttp://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_area_hrefhttp://www.google.com/jsref/venus.htm
  • 8/8/2019 Notes of Add on Content of Labs

    42/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Program to Change the src attribute of an iframe

    function changeSrc()

    {

    document.getElementById("myframe").src="http://google.com";

    }

    Your browser does not support iframes.



    Page 42

    http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_iframe_srchttp://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_iframe_src
  • 8/8/2019 Notes of Add on Content of Labs

    43/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    XML Program For CD catalogue

    Empire Burlesque

    Bob Dylan

    USA

    Columbia

    10.90

    1985

    Hide your heart

    Bonnie Tyler

    UK

    CBS Records

    9.90

    1988

    Page 43

  • 8/8/2019 Notes of Add on Content of Labs

    44/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Greatest Hits

    Dolly Parton

    USA

    RCA

    9.90

    1982

    Still got the blues

    Gary Moore

    UK

    Virgin records

    10.20

    1990

    Eros

    Eros Ramazzotti

    EU

    BMG

    9.90

    1997

    Page 44

  • 8/8/2019 Notes of Add on Content of Labs

    45/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    One night only

    Bee Gees

    UK

    Polydor

    10.90

    1998

    Sylvias Mother

    Dr.Hook

    UK

    CBS

    8.10

    1973

    Maggie May

    Rod Stewart

    UK

    Pickwick

    Page 45

  • 8/8/2019 Notes of Add on Content of Labs

    46/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    8.50

    1990

    Romanza

    Andrea Bocelli

    EU

    Polydor

    10.80

    1996

    When a man loves a woman

    Percy Sledge

    USA

    Atlantic

    8.70

    1987

    Black angel

    Savage Rose

    Page 46

  • 8/8/2019 Notes of Add on Content of Labs

    47/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    EU

    Mega

    10.90

    1995

    1999 Grammy Nominees

    Many

    USA

    Grammy

    10.20

    1999

    For the good times

    Kenny Rogers

    UK

    Mucik Master

    8.70

    1995

    Page 47

  • 8/8/2019 Notes of Add on Content of Labs

    48/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    Big Willie style

    Will Smith

    USA

    Columbia

    9.90

    1997

    Tupelo Honey

    Van Morrison

    UK

    Polydor

    8.20

    1971

    Soulsville

    Jorn Hoel

    Norway

    WEA

    7.90

    1996

    Page 48

  • 8/8/2019 Notes of Add on Content of Labs

    49/52

  • 8/8/2019 Notes of Add on Content of Labs

    50/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    1987

    Private Dancer

    Tina Turner

    UK

    Capitol

    8.90

    1983

    Midt om natten

    Kim Larsen

    EU

    Medley

    7.80

    1983

    Pavarotti Gala Concert

    Luciano Pavarotti

    UK

    Page 50

  • 8/8/2019 Notes of Add on Content of Labs

    51/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    DECCA

    9.90

    1991

    The dock of the bay

    Otis Redding

    USA

    Atlantic

    7.90

    1987

    Picture book

    Simply Red

    EU

    Elektra

    7.20

    1985

    Red

    Page 51

  • 8/8/2019 Notes of Add on Content of Labs

    52/52

    Geethanjali College Engineering and TechnologyDepartment Of CSE

    The Communards

    UK

    London

    7.80

    1987

    Unchain my heart

    Joe Cocker

    USA

    EMI

    8.20

    1987