Questions Answers

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Questions Answers as PDF for free.

More details

  • Words: 2,666
  • Pages: 21
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

Q 1. Create JavaScript program for Change Picture / Image onmouseOver .

Ans:-

grayrose.gif

bluerose.gif

Save above images in images folder & create file “mouseover.html “& put following code in file. <TITLE> Mouseover <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script language="JavaScript"> var picture1 = "images/bluerose.gif"; var picture2 = "images/grayrose.gif"; if (document.images) { image1 = new Image(); image1.src = picture1 image2 = new Image(); image2.src = picture2; } function mover(img){ document["change"].src = img.src; } function mout(img){ document["change"].src = img.src; }

Q 2. Create html page for background image. 1. use css class. © 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

2. Use given image

Ans:- Create new page “ background.html” & put following code. <TITLE> Background <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <style type="text/css"> .bodyback { background-image: url('images/pattern.gif') }

Q 3. Create Style sheet class for border-width Demonstration. Ans:- Create new page “ border.html” & put following code. border-width Demonstration <style type="text/css"> p.border { border-left-width:10px; border-left-color:blue; border-left-style:solid; © 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

border-right-width:20px; border-right-color:green; border-right-style:solid; border-top-width:30px; border-top-color:red; border-top-style:solid; border-bottom-width:40px; border-bottom-color:black; border-bottom-style:solid; }

The width of all borders should be different.



Q 4. Create Drop Down Menu Using JavaScript . 1. Use onmouseover & onmouseout events. 2. Apply css for all Dropdown menu. Ans:- Create new page “ dropdown.html” & put following code. <TITLE> Drop Down Menu <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <style> #sddm { margin: 0; padding: 0; z-index: 30} #sddm li { margin: 0; padding: 0; list-style: none; float: left; font: bold 11px arial} © 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

#sddm li a { display: block; margin: 0 1px 0 0; padding: 4px 10px; width: 60px; background: #5970B2; color: #FFF; text-align: center; text-decoration: none} #sddm li a:hover { background: #49A3FF} #sddm div { position: absolute; visibility: hidden; margin: 0; padding: 0; background: #EAEBD8; border: 1px solid #5970B2} #sddm div a { position: relative; display: block; margin: 0; padding: 5px 10px; width: auto; white-space: nowrap; text-align: left; text-decoration: none; background: #EAEBD8; color: #2875DE; font: 11px arial} #sddm div a:hover { background: #49A3FF; color: #FFF} <SCRIPT LANGUAGE="JavaScript">
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

// cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onclick = mclose; //-->


Q 5. Create Html page with following requirements. 1) Create form with validations & following fields... I . Your Name: ---- not blank II. Your Gender:(Male / Female) use radio buttons ---- one must be choose III. Your Age: ( listbox ) ---- one must be select IV. Email Address : ---- not blank, email validations Ans:- Create new page “ formvalidation.html” & put following code. A More Complex Form with JavaScript Validation <script type="text/javascript">
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

{ alert ( "Please fill in the 'Your Name' box." ); return false; } if ( ( document.contact_form.gender[0].checked == false ) && ( document.contact_form.gender[1].checked == false ) ) { alert ( "Please choose your Gender: Male or Female" ); return false; } if ( document.contact_form.age.selectedIndex == 0 ) { alert ( "Please select your Age." ); return false; } if (document.contact_form.email.value == "") { alert ("Please Enter Email"); //document.contact_form.email.focus(); return false; } var emailVal = document.contact_form.email.value; if ( emailVal == "" || emailVal.indexOf("@") <= 0 || emailVal.indexOf(".") <= 0 ) { alert("Please supply a valid email address"); // document.form1.email.focus(); return false; } return true; } //-->

Please Enter Your Details Below

Your Name:

Your Gender: Male Female



© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

Your Age: <select name="age">

Email Address :



Q 6. Write program for open popup window using onClick event. Ans:- Create new page “ popup.html” & put following code. <script type="text/javascript">

CLICK ME!



© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

Q 7. Write Module for Register, Apply javascript validation for registration, Display all Students information after registration & edit , delete student information using php. Ans:- 1) Create Database “ phpcourse ” create table “ student_info ”. 2) Add following fields in student_info table stud_id ( auto increment), stud_name, rollno, gender, address, phone, email, added_date 3) Create new page registration.html .put following code. <TITLE> registration <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script type="text/javascript"> function validate() { if (document.f1.name1.value == "" ) { alert ("Please Enter Name"); document.f1.name1.focus(); return false; } if (document.f1.rollno.value == "") { alert ("Please Enter Roll Number"); document.f1.rollno.focus(); return false; } if (isNaN(document.f1.rollno.value)) { alert ("Please Enter Valid Roll Number"); document.f1.rollno.focus(); return false; } if (isNaN(document.f1.phone.value)) { alert ("Please Enter Valid Phone Number"); document.f1.phone.focus(); return false; }

© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

if (document.f1.email.value == "") { alert ("Please Enter Email"); document.f1.email.focus(); return false; } var emailVal = document.f1.email.value; if ( emailVal == "" || emailVal.indexOf("@") <= 0 || emailVal.indexOf(".") <= 0 ) { alert("Please supply a valid email address"); document.f1.email.focus(); return false; } return true; }
 
<span class="largeText">Name :
<span class="largeText">Rollno :
<span class="largeText">Gender : M    F
<span class="largeText">Address : © 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

<select name="address">
<span class="largeText">Phone No :
<span class="largeText">E-mail :
 


4) Create new page config.php, put following code.
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

{ while(list($name,$value) = each($HTTP_GET_VARS)) { $$name = $value; }; }; // Get the names and values for post vars if (isset($HTTP_POST_VARS)) { while(list($name,$value) = each($HTTP_POST_VARS)) { $$name = $value; }; }; ?>

5) Create new page view_info.php & put following code in page. <TITLE> New Document <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT="">
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

('$name',$rollno,'$gend','$address',$phone,'$email','$date1')"; //echo $query1; mysql_query($query1) or die('Error, insert query failed'); //echo "Data Inserted Successfully"; } $query = "SELECT * FROM student_info"; $result = mysql_query($query); ?> "; } } ?>
<span class="largeText">Name <span class="largeText">Rollno <span class="largeText">Gender <span class="largeText">Address <span class="largeText">Phoneno <span class="largeText">E-mail <span class="largeText">Delete <span class="largeText">Edit
". $row["stud_name"]."". $row["rollno"]."". $row["gender"]."". $row["address"]."". $row["phone"]." ". $row["email"]."DeleteEdit
6) Create new file edit_insert.php & put following code..
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

$queryUp="UPDATE student_info SET stud_name=\"$name\", rollno=\"$rollno\", address=\"$address\", phone=\"$phone\", email=\"$email\" where stu_id=$stud_id"; $result = mysql_query($queryUp); //echo $queryUp; } header('location:view_info.php'); ?>

7) Create new file edit.php & put following code.. <TITLE> registration <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script type="text/javascript"> function validate() { if (document.f1.name1.value == "" ) { alert ("Please Enter Name"); document.f1.name1.focus(); return false; } if (document.f1.rollno.value == "") { alert ("Please Enter Roll Number"); document.f1.rollno.focus(); return false; } © 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

if (isNaN(document.f1.rollno.value)) { alert ("Please Enter Valid Roll Number"); document.f1.rollno.focus(); return false; } if (isNaN(document.f1.phone.value)) { alert ("Please Enter Valid Phone Number"); document.f1.phone.focus(); return false; } if (document.f1.email.value == "") { alert ("Please Enter Email"); document.f1.email.focus(); return false; } var emailVal = document.f1.email.value; if ( emailVal == "" || emailVal.indexOf("@") <= 0 || emailVal.indexOf(".") <= 0 ) { alert("Please supply a valid email address"); document.f1.email.focus(); return false; } return true; }
 
© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

Name : ">
Rollno : ">
Gender : M    F
Address : <select name="address">
Phone No : ">
E-mail : "> ">

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

$email=$_POST['email']; $email=$_POST['email']; if ($msg=="update") { if ($name!="") { $queryUp="UPDATE student_info SET stud_name=\"$name\", rollno=\"$rollno\", address=\"$address\", phone=\"$phone\", email=\"$email\" where stu_id=$stud_id"; $result = mysql_query($queryUp); } header('location: view_info.php'); }*/ ?>


8) Create new file delete.php & put following code..

Q 8. Create Login - Logout with a Session in 1 file. require 2 PHP files and 1 table of mySQL database. 1.index.php this file is the Login and Logout file. 2.main.php this file is the target when login is O.K. 3.Database "tutorial" and table "admin" with 3 fields: id(auto_increment), username(varchar, 50), password(varchar,

© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

Ans:- 1) Create new file index.php & put following code.. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Home
© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

User :
Password :
2) Create new file main.php & put following code.. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Untitled Document

Hello ! You are now Logged in.

Logout



Q 9. Create admin interface for adding and deleting users using mySQL. Ans:- 1) Create database ' phpcourse ' & table ' login ' with fields ( user, pass) 2) Create new file admin.php & put following code..
General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

?> $user successfully deleted

"); }*/ print("<strong>$user successfully deleted

"); } else { print("<strong>no users are available to delete yet, sorry.

"); } } elseif ($react == "add_user") { if(($user) and ($pass)) { /* $query = "INSERT into login VALUES ( "; $query .= "0, SYSDATE(), '$username', '$password' )";*/ $query ="INSERT INTO login (user, pass) VALUES('$user', '$pass')"; mysql_query($query, $mysql_link); } else { print("<strong>either your user or password field was left blank

"); } } else { print("

Administration Area - Choose your option
"); } ?>

Delete Users <select name="user" size="1"> $row[0]"); } } else { print(""); } ?>

© 2009 IT Shastra (I) Pvt. Ltd.

General Document (GENT002-V.1.0)

IT Shastra (I) Pvt. Ltd.

ADD A New User
User:
Pass:



© 2009 IT Shastra (I) Pvt. Ltd.

Related Documents

Questions Answers
November 2019 48
Questions Answers &
July 2020 24
Questions Answers
May 2020 17
Questions Answers
November 2019 36
Questions & Answers
May 2020 18