Vous êtes sur la page 1sur 3

Q71. How will you delete a Cookie? By setting its Expires property to any date prior to today Response.

Cookies("cookie name"). Expires = Date 1. Q72. What is Server Object? Controls the ASP execution environment. It can set the amount of time script can run before an error occurs. Converts a virtual path to a physical path on the server. Takes a user supplied string and encode it into proper format for a URL string. Q73. What is the function of Buffer in Response Object? Buffer controls the HTML output stream manually. Q74. What is Extranet? An area of a web site available only to a set of registered visitors. Q75. How are sessions maintained? A. The browser sends a cookie to the server with each request. B. The browser sends a Querystring variable to the server with each request. C. The browser sends a hidden Form variable to the server with each request. D. The browser sends a long variable to the server in the BODY of each request. E. None of the above. Q76. What is string concatenation function in VBScript? The ampersand symbol and ampersand space underscore across multiple lines Q77. What is an Err Object? The Err object holds information about the last runtime error that occurred. It is not necessary to create an instance of this object; it is intrinsic to VBScript. Its default property is Number, which contains an integer representing a VBScript error number or an ActiveX control Status Code (SCODE) number. This value is automatically generated when an error occurs and is reset to zero (no error) after an On Error Resume Next statement or after using the Clear method. The following code checks the value of the Number property and, if it contains a value other than zero, displays the details in the browser. Code: <% dim numerr, abouterr On Error Resume Next Err.Raise 6 numerr = Err.number abouterr = Err.description If numerr <> 0 Then Response.Write "An Error has occured! Error number " & numerr & " of_ the type '" & abouterr & "'." End If %> Q78. Explain string concatenation in VB script. Often it is advantageous to combine two or more strings into one. This operation of adding a string to another string is referred to as concatenation. The VBScript script concatenation operator is an ampersand "&" and occurs in between the two strings to be joined. This example will join a total of 4 strings to form a super string. Note: We only use one variable in this example! VBScript Code: <script type="text/vbscript"> Dim myString myString = "Hello there!" myString = myString & " My name" myString = myString & " is Frederick" myString = myString & " Nelson." document.write(myString) </script> Display: Hello there! My name is Frederick Nelson. Q79. State some string functions in VB script. Asc() - Returns ANSI Character Code The Asc() function returns the ANSI character code for the first letter of the string provided.

Chr() - Returns Character from ANSI Code The Chr() function returns the character associated with the specified ANSI character code. InStr() - Find a string within another The InStr() function returns the position of the first occurrence of one string within another. InStrRev() - Find a string within another (Reverse) The InStrRev() function returns the position of an occurrence of one string within another, starting from the end of string. LCase() - Convert a string to lowercase The LCase() function converts the supplied string to the lowercase equivalent. Left() - Crops a string from left The Left() function returns an optional number of characters of the supplied string starting from the left. Len() - Determine the length of a string The Len() function is used to determine the length or number of characters in a string. LTrim() - Remove leading spaces from a string The LTrim() function is used to remove the leading spaces from a string. Mid() - Crops a string The Mid() function returns an optional number of characters of the supplied string starting from the specified start position. Replace() - Replace a substring within a string The Replace() function is used to replace a specified substring with an alternate substring within a string. Right() - Crops a string from right The Right() function returns an optional number of characters of the supplied string starting from the right. RTrim() - Remove trailing spaces from a string The RTrim() function is used to remove the trailing spaces from a string. Space() - Creates a string with the specified number of spaces The Space() function creates a string including the specified number of spaces. StrComp() - Compare two strings The StrComp() function compares two strings and returns whether they are equal or not. String() - Creates a repeated character string The String() function creates a string of optional length filled with the specified character. StrReverse() - Reverse the characters of a string The StrReverse() function creates a string in which the character order of a specified string is reversed. Trim() - Remove both leading and trailing spaces from a string The Trim() function is used to remove both the leading and trailing spaces from a string. UCase() - Convert a string to uppercase The UCase() function converts the supplied string to the uppercase equivalent. Q80. What is the difference between client-side script and server-side script? Scripts executed only by the browser without contacting the server is called client-side script. It is browser dependent. The scripting code is visible to the user and hence not secure. Scripts executed by the web server and processed by the server is called server-side script. Q81. Write a programmer code to add buttons in JavaScript. The code below creates a form submit button: <input type="submit" name="mysubmit" value="Click!" /> name: specifies the identification assigned to this submit button. value: is the label that appears on the button. The name and value of the button that is pressed to submit the form is passed to the server side script. For the button above, when you click on the submit button, the data passed to the server side script is: mysubmit="Click!" Q82. How to Submit a Form Using JavaScript. Generally, a form is submitted when the user presses a submit button. However, sometimes, you may need to submit the form programmatically using JavaScript. JavaScript provides the form object that contains the submit() method. Use the id of the form to get the form object. For example, if the name of your form is myform, the JavaScript code for the submit call is: document.forms["myform"].submit(); But, how to identify a form? Give an id attribute in the form tag <form id='myform' action='formmail.pl'> Here is the code to submit a form when a hyperlink is clicked: <form name="myform" action="handle-data.php">

Search: <input type='text' name='query' /> <a href="javascript: submitform()">Search</a> </form> <script type="text/javascript"> function submitform() { document.myform.submit(); } </script>

Vous aimerez peut-être aussi