1 / 6

ASP-Code Examples

<% ..............ASP Codes ................. %>. if ....then ....else ...... end if. for ..............................next. do while .................... loop. database. response.write “ “ & “ “ & i. html IE Tuna Tuna <B> Tuna </B> Tuna

marty
Download Presentation

ASP-Code Examples

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. <% ..............ASP Codes ................. %> if ....then ....else ...... end if for ..............................next do while .................... loop database response.write “ “ & “ “ & i html IE TunaTuna <B>Tuna</B> Tuna <font size = “2”>Tuna</font> response.write“<font size = “2”>Tuna</font>“ typeMismatch ASP-Code Examples

  2. response.write response.write“<font size = “2”>Tuna</font>“ Handling Error: 1st way: Do not use “ “ in HTML! But; <font face = lucida handwriting>  face = lucida ? <% response.write<table width = 100%> %> ? 2nd way: use ‘ ‘ instead of “ “ Examples: Example 1:Adding 2 numbers <% num1 = 40 num2 = 30 response.write num1 + num2 %>

  3. response.write Example 2:finding y <%a=1b=5c=2y= b*b - 4*a*cresponse.write y%> Example 3:finding the square of 2 numbers and the addition of their square <%num1 = 10num2 = 20sq1 = num1 * num1sq2 = num2 * num2sum = num1 + num2response.writesq2 &","& sq1 & "," & sum

  4. response.write & if..then..else..end if Example 4:VAT included Price <%VAT = 18PRICE = 3000000VAT_INC = PRICE + (PRICE * VAT)/100Response.Write "VAT included price is"& " " & VAT_INC%> Example 5:positive or negative? <%num = 89IF num >0 THENresponse.write num &" "& "is a positive number.“ELSEresponse.write num &" "& "is a negative number.“END IF%>

  5. response.write & if..then..else..end if Example 6: If a number less than 10, output it's square otherwise the number only.<% num = 9IF num > 10 THENsq = num * numresponse.write sqELSEresponse.write numEND IF%> Example 7: Subtract the smaller from the larger <%num1 = 3num2 = 5IF num1>num2 THENnum = num1 - num2ELSEnum = num2 - num1END IF Response.Write num%>

  6. response.write & if..then..else..end if Example 8: SNG room 100$ others 150$> <% room_type = "DBL“num_of_night = 10IF room_type = "SNG" THENprice = 100 * num_of_night ELSEprice = 150 * num_of_nightEND IFResponse.Write "room price is " & price%> Example 9: PASS, FAIL <% final = 50IF final >= 50 THENResponse.Write "PASS“ELSEResponse.Write "FAIL“END IF%>

More Related