Tuesday, June 4, 2019
Scripting Types and Uses
ledgering Types and UsesA different type of scripting and their gives areMaintaining cookies Website uses cookies to onlyow the drug user to use the website easy for use cookies allow give your preference when visiting that website and gives you recommendations when buying things for example when buying things from the internet it will give you preferences to allow shopping much easier.Checking and verificatory input. The use of checking and validating input is when for example for searches or to check a certain box has been filed in correctly with the right information. browser detention Browser detection is when a user types a website in the search bar and it indicates recommendation of what you might be searching and it will show different types of searches to save up you time and effort.Some old browser does not support JavaScript and preempt cause problems when inserting autograph as the browser will not recognise and earn JavaScript. And it will just show a bunc h of economy into the webpage when loading it.To avoid this note script allows hypertext markup language to ignore the comment that the user has inputted so that it will not show on the web page.JavaScript is an target orientated and take downt driven.Nature of languages Procedural- line by line and it write instruction and the calculating machine just have to read it.Event driven Event driven is when a button is being executed by clicking that button. For exampleObject orientated language mean that the codes are broken down into objects or pieces and to each one objects has its own properties. Inserting scriptYou can add script instalment to any hypertext mark-up language document by adding extra code into the page. You can add the JavaScript on the head section, body section as long as you have an hatchway script and a closing script or else it would not work when opening it in a web browser as it would just show you bunch of codes. And also you would need to have a scr ipt type to be to tell the web page that it is a script.Object -Most things in JavaScript is an object e.g Boolean, numbers. An object is a type of data which has its properties own and discerns how to trigger it method actings.Examplevar person = firstNameJohn, lastNameDoe, age50, eyeColorblueExample from http//www.w3schools.com/js/js_object_definition.aspMethod A method is a collection of statement that are grouped, methods are actions that can be performed on objects. The document write means is to output a message on the screen and it could be value or text.Write() This will write something directly into a html page e.g. Click() this can be a radio button that user can select and click, e.g. Male or female.open() this is to open up new browsers or a new tab. This can be utilise if the user will need to have to go on a external website e.g. windows.open(www.google.co.uk)Properties properties are building block of objects. There are many types of properties in JavaScript. here(predicate) is an example of a property using JavaScript.Example from surf boldness website.Handling eventsEvents are things that happen to a HTML element. JavaScript can react to many events. Events are things that can happen in a browser. If an event is detected, then multiple thigs can happen in the browser e.g. a function might be triggered e.g. pressure sensation a button. These are some of the main eventOnclick this will activate when a HTML element has been click by a user.On slipover this is triggered when the user hovers their mouse on a HTML element.Onload this is triggered when the page has finished loading.Onkeydown this is triggered when the user presses the down arrow on the keyboard.A function is a piece of script that be called when the script is run.For exampleA function in JavaScript us defined with a function keyword, with a name, and parentheses (). Functions names can contain letters, numbers, and different types of symbols. The code can be executed if the code is inside a curly bracket .function name(parameter1, parameter2, parameter3) code to be executedExample is taken from http//www.w3schools.com/js/js_functions.aspWe use functions because we can reuse the code (define the code once and use it again as many times as the user wants).You can use the aforesaid(prenominal) code many times with a different argument.Hiding scripts Scripting language are not support in older browsers or updated browsers. Updated and newer browsers will know whats going in between the script, while older browser will not know. You can also comment to hide the script.Note scriptHTML CSS /* comment */JavaScript //You can also disable the script in the browsers settings.What we mean about the interaction and the use of client side scripting for web pages is that the client side uses a browser to connect to a static web pages that uses HTML and CSS that allows them to interact to the website. And that scripting allows the website to have interactivit y to a user and make it dynamic. For example, when a client pass information from the website e.g. looking for a holiday.Variable is a container that holds a value or it can be a whole text and data. It can be change anytimevar namefield=detailsform.fullname.valuevaluevariableevent.returnValue-falsethis means that the event which is submitted cannot be executed if box or container has no value.Security issues One of the most cat valium security problems of JavaScript is Cross-Site Scripting also known as XSS. Cross-Site Scripting enables the attackers to change the website to return a malicious script to user going on that website. As JavaScript is an object oriented scripting language, hackers can use tools such as XSS to write their code and harm the users machine and their information stored in the machine. The difficult thing about JavaScript malicious code is that it is hard to detect security breaches that are happening because its usually happening inside the website or ins ide the users machine without any warnings.https//www.veracode.com/security/javascript-securityThe HTML element tag we use to implement script is with an opening script and a closing script .If the user wants to run the same script in a different html page, then it should be best to put the JavaScript in one folder so that the user doesnt have to rewrite in all over again. You have to save the script file with a.js extension and you have to refer to it using the src attribute in the script tag.For exampleLoopsExample of loops example taken from Moodle.Loops is beneficial when you want to run the same code over and over again with different values.The For loop is the tool when you want to create a loopfor (statement 1 statement 2 statement 3)code block to be executedStatement 1 this is executed before loop even start (code block)Statement 2 defines the conditions for running the roomStatement 3 is executed each time the loop has been executed.http//www.w3schools.com/js/js_loop_f or.aspA IF statement is a curb statement that will allow the JavaScript to make decisionsFor exampleWe use the if conditions if the specified condition is true.We use the else conditions if the same specified condition is false.The dot operator is used to as a separation technique which separate the objects from their methods and properties.Functions are pieces of code that can be written separately or within the tags and can be called or executed whenever programed to. Functions are never executed unless they are called. Below is an example of a function being declared within the tags and being called.Script 1Internet ExplorerClicking the image on internet explorer will enlarge the image.Google ChromeIn google chrome, if you click the image the image will download to your computer.Mozilla FirefoxIn Mozilla Firefox, if you click the image the image will download to your computer.OperaIn opera , if you click the image the image will download to your computer.Script 2Internet Explo rer__________________________________________________________________________________Google Chrome__________________________________________________________________________________Mozilla Firefox_________________________________________________________________________________OperaThe browsers are output are different to each other because each of the way each browser renders web content. The code also runs differently depending on the browser you are using, this is because the string that it is being returned will vary between browsers.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.