0% found this document useful (0 votes)
32 views

Chapter 5 css

Css notes

Uploaded by

aditidhotre2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
32 views

Chapter 5 css

Css notes

Uploaded by

aditidhotre2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 52
Regular Expression, Rollover and Frames 5.1 Regular Expression — language of regular expression, finding non matching characters, entering a range of characters, matching digits and non-digits, Matching punctuations and symbols, matching words, replacing a text using regular expressions, | returning the matched characters, properties. Frames — create a frame, invisible borders of frame, calling a child window, changing a content and focus of a child window, writing to a child window, accessing elements of another child window. | 5.3 Rollover — creating rollover, text rollover, multiple actions for | rollover, more efficient rollover. » regular expression object 5.2 5.1 REGULAR EXPRESSION SEE SERRATE EAERESSION Sree t ©. Describe the term regular expression. } ' 6. Explain the use of RegExp methods with example. ' ‘RQ List and describe the use of RegExp modifiers. : List and describe the use of character classes, ' 1 i $2 List and describe the use of metacharacters. 1 Ust and describe the use of quantifiers. ~ Describe the term language of regular expression A regular expression is a sequence of characters that forms a search Pattern, Cent Side Scripting Language (MSBTE) (Reg. Exp. Rollover & Frames) Py. ng 20-59) * — In other words, regular expressions are patterns used to match Charag combinations in strings. i * In JavaScript, a regular expression is an object that describes a Sequeng, of characters used for defining a search pattern and that search Pattern . describe what we are searching for. 7 * tis commonly known as "regex" or "RegExp", are a specially formatted text strings used to find patterns in text. * A regular expression is a pattern of characters. The pattern is used to do pattern-matching "search-and-replace" functions on text. It can be useq to perform all types of text search and texts replace operations. ¢ A regular expression can be a single character, or a more complicated pattern. ¢ Regular expressions are useful for searching and replacing strings that match a pattern. They have many useful applications. e — It is a more powerful way for effective and efficient text processing and manipulations. e For example, it can be used to verify whether the format of data ie. name, email, phone number, etc. entered by the user is correct or not, find or replace matching string within text content, and so on. RegExp Methods e In JavaScript, regular expressions are often used with the two string methods: search() and replace(). * The search() method uses an expression to search for a match, and returns the position of the match. * The replace() method returns a modified string where the pattern 1S replaced. Following RegExp methods are: Description — a Executes a search for a match in a string and returns an | 7 ication® array of information. It returns null on a mismatch. Tests for a match in a string and returns true or false. Tech-Neo Publi a (New Syll. w.e.f academic year 19-20) (D5-16A) Ge nt i88 seripting Language (MSBTE) _ (Reg. Exp., Rollover & Frames) Pg_no. (5-3) iol “atch It returns an array containing all the matches; returns null on a mismatch. It returns an iterator containing all of the matches. | watch matches _| I earch) Tests for a match in a string and returns the index of the match. It returns -1 if the search fails. “eplace() It searches for a match in a string and replaces the matched substring with a replacement substring. split) It break a string into an array of substrings. search() method «The search() method takes a regular expression/pattern as argument and search for the specified match pattern in the string. * This method returns the index where the match found otherwise it Tetums -1 if the search fails. Syntax *t-search(/pattern/attributes) Sample ‘U9. Describe regular expression. Explain search () method used in } ' fegular expression with suitable example. ' ' 1 1 MSBTE -Q — > String Example</itle> </head> ody > “seript = func | “on myFunction() { “PUL string Mar 1 "Cood Morming!"; ‘ae « ‘arching string with modifier i a * str se ‘arch(/Morning/i); eur Seatovrite(a + ‘<be>')s Ne — : : “S¥ll. wef academic year 19-20) (D5-16A) Wal recn Neo Publications ee Client Side Scripting Language (MSBTE) _(Reg. Exp., Rollover & Frames) Po. no, 4 #/ searching string without modifier i var'n = str.search(/Moming/); document. write(n); } myFunction(); </script> </body> </htal > Output o D) String Example x Ee : G © File | D:/TechNeo%20Publications/search.htmI RegExp Flags / Modifiers Flags are used with regular expressions that allow various options such as global search, case-insensitive search, etc. It can be use separately or together. “ml 6 oa g Performs a global match (find all matches) m Performs multiline match i Performs case-insensitive matching Character Classes ‘Square brackets surrounding a pattern of characters are called a charactet class e.g. [abc]. A character class always matches a single character out of a list of specified characters that means the expression [abc] matches only a bor c character. A negated character class is defined by placing a caret (*) symbol immediately after the opening bracket, like [abc], which matches #") character except a, b, and c, ey Sse nn ena See ene ene nnn Cnn cal s (New Syll. w.e.f academic year 19-20) (D5-16A) lal rech-neo Publication _ —— CO nt Side Scripting Language (MSBTE) (Reg, Exp., Rollover & Frames) Pg. no. (5-5) » The range of characters is defined by using the hyphen (-) character inside a character class, like [0-9]. following character classes are: Description Matches any one of the characters a, b, or c. [Aabc] Matches any one character other than a, b, or c. | [az] Matches any one character from lowercase a to lowercase z. [A-Z] Matches any one character from uppercase A to uppercase Z [eZ] Matches any one character from lowercase a to uppercase Z. | [0-9] Matches a single digit between 0 and 9. r . | [a-20-9) Manes a single character between a and z or between 0 Predefined Character Classes / Metacharacters * A metacharacter is simply an alphabetical character preceded by a backslash that acts to give the combination a special meaning. ¢ It works similar like character classes and it is use shorthand character expression to represent patterns in regular expressions. Following predefined character classes are: ian oe ee Matches any single character except newline \n. \d Matches any digit character. Same as [0-9] | Matches any non-digit character. Same as [0-9] | \s Matches any whitespace character (space, tab, newline or } carriage return character). Same as [ \t\n\r] \s Matches any non-whitespace character. Same as [* \t\n\r] | \w Matches any word character (defined as a to z, A to Z,0 to 9, and the underscore). Same as [a-zA-Z_0-9] _\w Matches any non-word character. Same as [*a-zA-Z_0-9] New Syl, wef academic year 19-20) (D5-16A) ae ech-Neo Publications SSS =e — Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg, no (64 =) Repetition Quantifiers © The quantifiers are used to specify how many times a character in regular expression should match. ‘ * — Quantifiers can be applied to the individual characters, as well as Classes of characters, and groups of characters contained by the parentheses, Following repetition quantifiers are: Expression Description pt Matches one or more occurrences of the letter p. p* Matches zero or more occurrences of the letter p. p? Matches zero or one occurrences of the letter p. p{2} Matches exactly two occurrences of the letter p. Matches at least two occurrences of the letter p, but not more than three occurrences p{2,3} p{2,} Matches two or more occurrences of the letter p. pt.3} Matches at most three occurrences of the letter p Ya 5.1.1 Language of Regular Expression e Language of regular expressions specifies the patterns used to match character combinations in strings. e In JavaScript, a Regular Expression (RegEx) is an object that describes 2 sequence of characters used for defining a search pattern. Syntax var pattern = new Reg:xp(patter, attributes); : pattern — A string that specifies the pattern of the regular expression O° another regular expression. attributes — An optional string containing any of the " attributes that specify global, case-insensitive, and multi-line respectively. i", and “" matches at ions Bal rech-Neo Publication (New Syll. wef academic year 19-20) (D5-16A) gide Senpting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-7) are two different ways to create a regular expression in JavaScript: sing ® regular expression literal ; regular expression consists of a pattern enclosed between slashes /. The seat regularEXP = fabo/; ere. jabc/ is a regular expression. b Using the RegExp() constructor function gecond way, tO create a regular expression by calling the RegExp() constructor function. Example const reguarExp = new RegExp(‘abc'); OR const regex = new RegExp(/~a...s8/); console.log(regex-test(‘alias')); // true In the above example, the string alias matches with the RegEx pattern /“a...s$/. Here, the test() method is used to check if the string| matches the pattem; return true if string is matched. %& 5.1.2 Finding Non Matching Characters * The character class expression [Aa-z] (non-lowercase) is use to find out non-matching characters from lowercase [a] to lowercase [z] by adding caret () symbol at the beginning of a string. We can also find out non-matching characters from uppercase and digit by using [‘A-Z] (non-uppercase) and [*0-9] (non-digit) character classes expression. ‘ample 1S Write a Program to find non-matching characters in given regular : ‘____ &xpression. ! “head > <title> JayaSeript Regular Expression Scripps Newsy. a "Syll. we. academic year 19-20) (D5-16A) [al rech Neo Publications Client Side Scripting Language (MSBTE) _(Reg. Exp., Rollover & Frames) Pg. no, 6) var myStr = "Ravi@123"; | var reg = /[“a-z]/g; var match = myStr.mateh(reg): document.write(match); Output 2 ivatirign Regular Expression x + Co © File | Dy/TechNeo%20Publications/regexhtmt R@1,23 ws 5.1.3 Entering a Range of Characters ing regular expression. in the use of bracket list character class usi Bracket List (Character Class) © Brackets ([]) have a special meaning when used in thé context of regular expressions. They are used to find a range of characters. e A bracket expression is a list of characters enclosed by [ ], also called character class. © It matches any one character in the list. However, if the first character of the list is the caret (4), then it matches any one character not in the list. For example, the regex [02468] matches a single digit 0, 2, 4, 6, or 8; the regex [*02468] matches any single character other than 0, 2, 4, 6, or 8. e Instead of listing all characters, you could use a range expression inside the bracket. e A range expression consists of two characters separated by a hyphen ©): It matches any single character that sorts between the two characters. inclusive. (New Syll. w.e.f academic year 19-20) (D5-16A) Tech-Neo Publications (Reg. Exp., Rollover & Frames) Pg. 10 (5-9) example, [a-d] is the same as [abed]. You could include a caret (*) in of the range '° invert the matching. For example, [Aad] is equivalent to [Aabed]. prackets Expression Expression Description r tl Any one character between the brackets. [] Any one character not between the brackets. [0-9] It matches any decimal digit from 0 through 9. [a-z] It matches any character from lowercase a through lowercase z. [A-Z] It matches any character from uppercase A through uppercase Z. [a-Z] It matches any character from lowercase a through | uppercase Z. i { match pattern | oer vieguler expression JavaScript Regular Expression ‘Sseript> “«'myStr = “PrashantSomwanshi"; “Ar reg = /[a-cV/g; “' match = myStrmatch(reg)s Sccument.write(match); “teeripr> “Shody > Shea) > Syll. wef academic year 19-20) (D5-16A) Bal rech-teo Publications Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Fram 1. (64 ee UO (MSB’ sashes cemnincnnecmaenn Ce), (510) Out tput x + CG © Fite | Diy/TechNeo%20Publications/regex6.htmy TD Javascript Regutar Expression 1a,8,ha.n.tomwanshi Note: Ih above example, use regex pattern (a-2] - It matches any characte, from lowercase [a] through lowercase [z}, %® 5.1.4 Matching Digits and Non-digits Matching digits * The \d predefined character class is use to match any digit character, * — Itis work similar like as [0-9] character class. JavaScript Regular Expressi <body> : <script> var myStr = "100% Ravi!"; var reg = /\d/g; var match = myStr.match(reg); document.write(match); </script> <body> </bunl > (New Syll wef academic year 19-20) (D5-16A) lal rech.weo Publications —_— yng Language (MSBTE) (Re, Exp. Rollover & Frames) Pg. no (5-11) —— 0 [})_ JavaScnpt Regular Expression x + oC © Fite | Di/TechNeo%20Publications/regex2.htm! 1,0,0 matching non — digits » The \D predefined character class is used to match any non - digit character. « Itis work similar like as [0-9] character class. ' 16Q Write a program to find match non digit in given regular expression : <hunl> <head> <title>JavaScript Regular Expression as; > C52. ¢ var myStr = "100% Ravi!"; var reg = \D/g; : var match = myStr.match(reg); document. write(match); j ‘S/ecript> S/htmn) > Output [es a JavaScript Regular Expression = it | G — G file | DyfTechNeo%20Publications/JS%20programs/regex 1.ntmi (New SYIl. w.e.f academic year 19-20) (D5-16A) lel Tech-Neo Publications a Client Side Scripting Language (MSBTE) (Reg. Exp. Rollover Frames) Pa. nog. (5 5.1.5 Matching Punctuations and Symbols Matching punctuations t '6Q. What is puictuation? Pee Oe eee ee ee Punctuation is marks used in printing and writing to separate sentences and clauses and to help make the meaning of sentences more clear. Comm 8, periods and question marks are examples of punctuation. Example '6Q_ Write @ prooram “6 fad rateh punctuation mark in given regula | ences : Weare Gen ee JavaScript Regular Expression var myStr = "2," xf var reg = /[*,+8.8% #l@! Ve oo Oo File | DVledie20P ication een Note: In above example, output contains punctuation marks like commas} (,), periods (.) and question marks (2) : ; (New Syll. w.e.f academic year 19-20) (D5-16A) Tech-Neo Publications specie! § eee ing symbols Characters in Regex Jar expressions have a set of special characters that each has a different reason when used. Description se Meaning _ ‘\ | Backstash Used to escape a special ¢ character + | caret Beginning of a string § | Dollar sign End of a string Period or dot Matches any single character —T . —r | | Vertical bar or pipe | Matches previous OR next symbol character/group | " Question mark Match zero or one of the previous oT | * | Asterisk or star Match zero, one or more of the previous | + | Plus sign Match one or more of the previous () | Opening and closing parenthesis (1 | Opening and closing square bracket = Opening and closing curly brace Group characters Matches a range of characters Matches a_ specified occurrences of the previous number _\> | word boundary at the beginning and/or end of a string ‘ample 169, Write a program to find match special character in given regular | ' {23 expression. ' shim> “head > JavaScript Regular Expression Xbady > ly > New s, = Syll. wef academic year 19-20) (D5-16A) TO Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg, no 5. 14) var reg = /[*,+$.&% ~#|@!?/gs var match = myStrmatch(reg); document.write(match); Output 6 a JavaScript Regular Expression x be é GS © Fite | D:/TechNeo%20Publications/regex8.htmt SA. 2 5.1.6 Matching Words © The match() function is use to match a word pattern (enclosed between slashes /.../) in given string; if match word is found return matched word else returns null on mismatch. e Another way, the pattern consists of slashes with token \b is called a word boundary; it is use to match a word between start \b and end \b boundaries. © In addition, use \w predefine character class to matches any word character pattern from [a-zA-Z_0-9]. Txample © 1 ces Output TD String Example x ae CG © Fite | Dyteceo20Pubicatonseece2 in Good Afternoon Ravi. Good Aftemoon Akash 2. Using normal string © The replace() method returns a new string with the value replaced. e — If you replace a value, only the first instance will be replaced. To replace all instances, use either a replaceAll() method or regular expression with the g modifier set. Syntax string.replace(originalstr, newst OR oe : string.replaceAll (originalstr, newstr). Example 1 Suacceeun’ Example Piheed — Bal tech-Neo Publication® a (New Syll. w.e.f academic year 19-20) (D5-16A) .g Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-19) BB string Example x + C © Fite | Di/TechNeo%20Publications/replace3. htm serpt is «programming language; JS is an object based language | j G OR File re | ee ae basen is a programming language; JavaScript i is an object based fe Eumple 3 cage mm om enon eects OT LER ARIE OPT TE ETT I - Write a JavaScript that will replace following specified value with | _ nother value in string. 1 ' 1 \ =. = “Twill fail” Sy W.e.f academic year 19-20) (D5-16A) Pt Tech-Neo Publications oo” Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Py, no, (62 var myStr = "1 will fail"; var newStr = myStr.replace("fail”, "pass"; document.write(newStr); C—O Fie | DyTechNeot%20Publications/replaces htm I wall pass YW. 5.1.8 Returning the Matched Characters * There are two functions which return the match character; first is match() and second is exec(). The match() is a method which is available on string and takes a regex as an argument, so it is define like str.match(regex). © The exec() is a method which is available on a regex and takes a string as an argument, so it is define like regex.exec(str). Both match() and exec() functions searches a string for a match against a regular expression, and returns the matches, as an array object otherwise it will return null. {@Q Write a mao to find pata) any characters in given regular ' JavaSeript Regular Expression vas mySer = "Prashant Somwanshi"; war seg * /A-Z)ip; var maich = myStranatch(reg); (New Syll w.ef academic year 19-20) (D5-16A) lal rect Neo puplicatio”® _-ument.write(match); seript> body > html > utput oO DB) JavaScript Regular Expression x @ , o ® File | Oy/TechNeo%20Publications/regex13.htm! te: In above example, use regex pattem [A-Z] - It matches any character from uppercase [A] through uppercase [Z]. A regular expression is a pattern of characters. The pattern is used to do pattern-matching “search-and-replace” functions on text. In JavaScript, a RegExp Object is a pattern with properties and methods. ‘e following are the list of poe Properties of regular expression : “Description “Onstructor Returns the function that created the RegExp object's Prototype Checks whether the "g" modifier is set in “reCase_| Checks whether the "i" modifier is set Specifies the index at which to start the next match ~ Tl checks whether the " im" modifier is set —~ Returns the text of the ly ‘pattern *YSyI, ce W.ef academic year 19-20) (D5-16A) [Blech Neo Publications ing Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. 2) Client Side S: perty The constructor property returns the function that created the Reet xy prototype. e Fora regular expression, the constructor property returns: function RegExp0) { [native code] } 1. RegExp constructor Pro| Syntax RegExpObject.constructor Example : : Javi Se et Regal Eien iile> eihead = Output fl DBD) JaveScript Regular Expression =X So © File | DyTechNveo%20Publications/regex 104! function RegExpO { {native code] } 2. RegExp global Property * The global property specifies whether or not the "g" modifier is set ¢ This property returns true if the "g" modifier is set, otherwise it recur false. Syntax RegExpObject.global (New Syll. w.e.f academic year 19-20) (D5-16A) Tech-Neo publicatio”” Rollover & Frames) Pg guint Sul sa [qvctitle> JavaScript Regular Expression = jitle > edly > Snell World) - Mello World/p; aiterd ja pe jatert = pattern. global; docume Output ntowrite(text)s CD) JavaScript Regular Expression =x + CG © File | D:/TechNeo%20Publications/regext1.htmi | tue | 3. RegExp ignoreCase Property The ignoreCase property specifies whether or not the "i" modifier is set. * This Property returns true if the "i" modifier is set, otherwise it returns false. Syntax WeehapObject ignoreCase ‘ample Shunt > teat Shady *“llle > JavaScript Regular Expression “teripes Mey Pattie, ‘em = (Hetlo World/i; ‘l “Wwe academic year 19-20) (5-164) (el Tech:Neo Publications FSEEEEEERC EP oPg ggg ECE EEE ~~ ‘p., Rollover & Frames) Pg, 20. (5.3 (5-24 Client Side Scripting Language (MSBTE) (Reg. Exp. RONCNS' SINS , Jet text = pattern. ignoreCases document.write(text); Output TD —_[Y Javascript Reguiar Expression X + Co @ File | D:/TechNeo%20Publications/regex12.htm| | | | —_——]$?]$?———$——$————————————— 1 5.2 FRAMES (GQ. Whatisframe? : ). Describe Frame Object with attributes. - 1 GQ. _ Describe Frameset Object with attribut | GQ... Describe IFrame Object with at e HTML frames are used to divide your browser window into multiple sections where each section can load a separate HTML document. © Accollection of frames in the browser window is known as a frameset. ¢ The window is divided into frames in a similar way the tables ar organized: into rows and columns. Frame Object « Frame object represents an HTML frame which defines one particular window (frame) within a frameset. ¢ It defines the set of frame that make up the browser window. © — It isa property of the window object. ¢ It has no end tag but they need to be closed properly. © Itisan HTML element. (New Syll. wef academic year 19-20) (D5-16A) [a rech.-neo Publication — gide Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-25) A frame should be used within a tag. Tag Attributes Description It is used to give the file name that should be located in the frame. Its value can be any URL. For example: src= “/html/abc.htm!”” It allows you to give a name to a frame. This attribute is used | to indicate that a document should be loaded into a frame. It specifies whether or not the borders of that frame are | shown. This attribute overrides the value given in the frameborder attribute on the tag if one is given. This can take | * | values either 1 (Yes) or 0 (No). It allows you to specify the width of the space between the left and right of the frame's border and the content. The value is given in pixels. For example : marginwidth = “10”. It allows you to specify the height of the space between the top and bottom of the frame's borders and its contents. The value is given in pixels. | For example: marginheight = lO | By default, you can resize any frame by clicking and | dragging on the borders of a frame. It prevents a user from | being able to resize the frame. | For example: noresize = " “noresize”. | It controls the appearance of the scrollbars that appear on the | frame, It takes values either “Yes”, “No” or “Auto” For example : scrolling = “no” means it should not have | a4 scroll bars. | Itallows you to provide alink to another | page Which contains a Jong description of the contents of the frame. | For example: longdese = “framedescription html” | We academic year 19-20) (DS 16) (ta) Tech Neo Publications oo Client Side Scripting Language (MSBTE) (Reg. Exp. Rollover & Frames) Pa. no. (5.25 Frameset Object © Frameset object holds two or more frame elements and each frame element in turn holds a separate document. © = This object states only how many columns or rows there will be in the t frameset. FRAMESET> Tag Attributes Attribute Description cols (Columns) It specifies how many columns are to be contained in the frameset and the size of each column. Value of this L attributes can be pixels, percentage and “*”. TOWS It works like the ‘cols’ attribute and takes the same | values, but it is used to specify the number of rows in the frameset. Value of this attributes can be pixels, percentage and “*”. border It specifies the width of the border of each frame in pixels. For example; border = “5”. A value of zero means no border. | frame It specifies whether a three-dimensional border should | be displayed between frames. It takes value either | (Yes) or 0 (No). For example : frameborder = “0” specifies no border. | | | framespacing It specifies the amount of space between frames in 4 | frameset. It can take any integer value. | For example : framespacing = “10” means thet should be 10 pixels spacing between each frame. IFrame Object IFrame object represents an HTML inline frame that contains another document. ficatio” Tech-Neo Pub _— (New Syll. w.e.f academic year 19-20) (D5-16A) » Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-27) BE i tage] It aligns the iframe. (Document | It returns the document object generated by a frame/iframe. Window It returns the window object generated by a frame/iframe. It sets frame border in a frame/iframe. It sets the height in an iframe. It sets the value of the longdesc attribute in a frame/iframe. Height It sets the margin height in a frame/iframe. It sets the margin width in a frame/iframe. It specifies the name to the frame. | It disables the frame resizing capability. It controls the appearance of horizontal and vertical _| scrollbars in a frame. It indicates the location of the web page to be loaded into the frame. It sets or returns the value of the width attribute in an iframe. “1 Create a Frame lag. The tag defines, how to divide the window into frames. TOWs attribute of tag defines horizontal frames and cols defines vertical frames. Swe academic year 19-20) (D5-16A) (ta) Tech-Neo Publications an Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no, (5-28) ° Each’ frame is indicated by tag and it defines which HTML document shall Open into the frame. Steps 1. Use the element instead of the element in an HTML document. 2. Add the size of a frame; insert the desired value in the cols or Tows attributes. Frames can be sized in either pixels or percentages, or they can be set to automatically adjust in size based on the available space, 3. Use the element to create frames for the content of the web page. 4. Use the sre attribute of element to identify the resource that should be loaded inside each frame. 5. Create different files with the contents for each frame. Also src attribute specify URL instead of local files. Syntax Bi! tech-Neo Publication® — (New Syll. wef academic year 19-20) (D5-16A) ent Side Scripting Language (MSBTE) (Reg, Exp., Rollover & Frames) Pg. no. (5-29) | Output G Ofite | DyTechNeo%20Pu,. A’ % ¢ Frame 1 Contents of Frame 1 || Contents of Frame 2 | Frame 4 || Contents of Frame 4 MSBTE - Q. 6(b), W-19, 6 Marks | Shiead > bodys. titke> Frame Example New 5 ll. wef academic year 19-20) (DS-16A) Eabrech-neo Publications LL eee Ghent Side Sorting Language (MSSTE) Rag Exe. Rotover & Frames) 5: Fruits File Contents of fruits file File 2 : flowers. html Frame Example Flowers File Contents of flowers file File 3 : cities html oo Frame Example Cities File
Contents of cities file
: File 4 : frame.html . Frame Demo :
FRAME FRAME 2 aw” (New Syl wef academic year 19:20) (D5: 16A) Ube) re ty-tNeo Publ — cient Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-31) eid <> S
: : Output © DB Frome Demo GS © File | Drtecnnecs20Publeation/ame it FRAME Fruits File Contents of fruits file The following ways to make frame border invisible: 1, Using Output (Frame without border) oO DD Frame Example x ob Co © Fie | DyTechNeo%20Publications/framed.htm! Frame Example ‘Seep to content| ISO 9001:2015 | #SONEC 27001:2013 | FAQ | RT | Director interview on SAMYADRI TV s Tech-Neo pulicatio” fk (New Syll. w.e.f academic year 19-20) (D5-16A) client Side Scripting Language (MSBTE) (Reg. Exp, Rollover & Frames) Pg. no. (5-33) NE (frame with border) TD) Frame Example x + CS © Fite D:/TechNeo%20Publications/framed html Frame Example swe te content| 150 90012015 | ISONEC 270012013 | FAQ | RT [ee | Olrector Interview on SAHYADRI TV 2. Using tag or tag * It is possible to make the borders invisible of all the frames which are containing within tag by using the border attribute. * To set the value of anyone attribute is like border="0" or frameborder="0" or frameBorder="0" or frameborder="no" for disabling the borders of all frames. * It is also possible to remove only specific frame borders, use the frameborder attribute in the tag and set the value to "no" (default is "yes"). This will remove the borders only from the specific frames. Example Frame Example ‘frame sre="frame_1.btml"> ‘frame sre="frame_2.himl"> “frame sse="frame_3.htm!" > “ftutne sre="frame_4.btonl" > “Hrameser> S/htent > (New Syl. wef academic year 19-20) (D5-16A) ll rech-rveo Publications bh Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no, (534) Output CD Fametinmete xe GD Fie | ovTecnNeos 200 ueationramed htm Frame 1 Frame 2 Concent of Frame} tumee ana | | | | | | | Frame 3 Frame 4 Cosco of Frame s Content Frames ws 5.2.3 Calling a Child Window e A window that opens inside a parent window is a child window. We can create multiple frames in a web page; that web page is called as parent window for other multiple child frames. © We can call or access one child window/frame from another child window/frame by using “parent” property. © The parent property returns the parent window (of the current window). It is read-only and not the same as the top property. e The window.parent returns the immediate parent of a window and window.top returns the topmost window in the hierarchy of windows. Syntax window.parent OR parent — : ions (New Syll. w.e.f academic year 19-20) (D5-16A) Tech-Neo Publicatio” - ere eee | cgnt side Senpting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-35) o [)_ Frame Example x + ~ a * GO File | DyTechNeow20Pu.. AY ve Qo Frame 1 Frame 2 Contents of Frame 1 || Contents of Frame 2 Frame 3 Frame 4 Contents of Frame 3 | Contents of Frame 4 File : parent Win.html ‘Sbiml> “Shead> Parent Window “frameset cols="#,4"> “fame sre="f) him" name="f1"> “frame sro="f2 htm" name="12"> “Arameset> ‘tht > Mle fl.btmi Shunt “tead> Child Window! ‘ te SV wes academic year 1 9-20) (D5-16A) Tech-Neo Publications eb, Client Side Scripting Language (MSBTE)_(Reg. Exp. Rollover & Frames) Pa. no. §.aq File 3 : f2.html Child Window2 Frame 2 Output @efore Click) iHome i Bookmarts The Mocila Organization 4 Latest Builds Frame 1 Frame 2 ‘Click Me Tech-Neo Publicatio"® ad (New Syll. w.e.f academic year 19-20) (D5-16A) - rent Side Scripting Language (MSBTE) (Reg_ Exp. Rokover & Frames) Pd. 00 (5-39) (after Click’ 5 econ ‘Moaita (Build 10: 2002053012) ] ° Be Ea Yow So Bookmarks Joo ifindow Help | | (a. 2: 7 - 2, a & fies //0-echheo ZR tehettvoral parertlin Prd rE oan WG Bockmarts Gf The Mezila Organcation ff Latest Builds _ Wargo = Frame 1 fees | ai Fras ‘egetables (Coke | _Reset | % 5.2.5 Writing to a Child Window We can write the contents on child window from another child window by using the write() method of document object. Example File 1 : parentWin.btml Parent Window frame ere="{2.html” name="{2"> SArameset> ‘ File 2 : f1.html ‘Shteal> ‘ Child Window! </itle> </head> Shody> hl > Frame 1</hl> Steript> function show(){ PAteOL 2 document.write(”This message is written by Frame }"); } - ae New Sill w ef academic year 19-20) (D5-16A) (al Tech-Neo Publications Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-40) </script> <input type="button" name="button1" yalue="Click Me" onclick ="show()"/> </body> </hml> File 3 : f2.html <html> <head> <title>Child Window2</itle> </head> <body> <hl>Frame 2</h>~ <p id="frame2">Content of Frame2</p> </body> </html> Output (Before Click) ' Parent Window - Mozilla {Build ID: 2002053012) [_Be_ Est Yew Go_Bookravks Toot Window tp -2 .3 & Se i = Gh Home Wh Bookmarks 4 The Mozilla Organization 4 Latest Builds Frame 1 Click Me. (After Click) '%} Parent Window - Mocilla {Build 1D: 2002053012} Ble Edt View Go fookmarts Took Window Hep = x a oar : f + © © a a Ne i hte : & fn Sop & fitez///0:(TechNeo%20P ublications/parentWin : F pHome Bookmarks 4 The Mozilla Organization 4 Latest Builds ‘This message is written by Frame 1 Frame 1 (New Syll. w.e.f academic year 19-20) (D5-16A) & Tech-Neo Publications - a ent side Soripting Languece (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no. (5-41) ci wo 52° 6 Accessing Elements of Another Child Window iq__How to access elements of enother child window explain with t example. ' Semel Cub Ae ebb oe sed » We can access the elements of one child window from other child window using methods of document object and the contents of document can be changed without refreshing the web page by using innerHTML property. « The important methods of document object are: 1. getElementByld() 2. getElementsByName() 3. getElementsByTagName() 4. getElementsByClassName() Example File 1 ; parent Win.html shead> <title>C hil Window1 Sbody> Shi >Frame 1 > function show(){ Parent.fo document. getE! JementByld("frame2").innerHTML= "This message is Sten en by Frame 1"; (New sy |. w.e.f academic year 19-20) (D5-16A) (tel Tech-Neo Publications oe Client Side Scripting Language (MSBTE) (Reg. Exp., Rollover & Frames) Pg. no (54) +

You might also like