Unit 2 computer systems

To access certain content you need to have the necessary plug-in, for example to access flash content, you need to install the flash plug-in in your browser. But to use JavaScript, you don’t have to use any plug-in at all. This is because all browsers have accepted JavaScript as a scripting language and so they provide integrated support for it.ControlA great feature of JavaScript is the control you have over the browser. There are various things you can control such as the background colour, this feature servers more than one purpose. Most people would change the colour of a webpage just because the option is there but it can also be a huge help for people who are visually impaired.Also read about Knowledge of PC boot processData ValidationBeing able to validate a users input is another great feature of JavaScript. Most websites will have a section where you may need to input some data (contact form, registration and more) and if you were to enter your name in a section that is expecting numeric input you will get an error message. The reason data validation is so useful is the fact it validates your input immediately, so you don’t have to waste time by waiting for the server to validate it.Detecting a Users OS or BrowserMany people use JavaScript to detect a user’s operating system or browser, if this feature is used properly then it can help you control your website much easier. When the script discovers your browser it can then load files that have been fine tuned for that specific browser, eliminating/reducing problems that page may have had.Design, Create and Test -P5Using my website I created for P4 I plan to add some cool features that allow interactivity, I will add a browser/OS detector, a form which requires an e-mail address (data validation) and an option to see how many minuets you have been on the site.Browser/OS DetectionDesign:Separate documentCreate:;script type=”text/javascript”;var browser=navigator.appName;var b_version=navigator.appVersion;var version=parseFloat(b_version);document.write(“Browser name: “+ browser);document.write(“<br />”);document.write(“Browser version: “+ version);;/script;Browser;script;var OSName=”Unknown OS”;if (navigator.appVersion.indexOf(“Win”)!=-1) OSName=”Windows”;if (navigator.appVersion.indexOf(“Mac”)!=-1) OSName=”MacOS”;if (navigator.appVersion.indexOf(“X11″)!=-1) OSName=”UNIX”;if (navigator.appVersion.indexOf(“Linux”)!=-1) OSName=”Linux”;document.write(‘Your OS: ‘+OSName);;/script;OSTest:This screenshot shows the Browser and OS Information is working as intended.Data ValidationDesign:- Separate document.Create:Header;script type=”text/javascript”;function validate_email(field,alerttxt){with (field){apos=value.indexOf(“@”);dotpos=value.lastIndexOf(“.”);if (apos;1||dotpos-apos;2){alert(alerttxt);return false;}else {return true;}}}function validate_form(thisform){with (thisform){if (validate_email(email,”Not a valid e-mail address!”)==false){email.focus();return false;}}};/script;Form;form action=”index.html” onsubmit=”return validate_form(this);” method=”post”;Email: ;input type=”text” name=”email” size=”30″;;input type=”submit” value=”Submit”;;/form;Test:This screenshot show the box you enter the email address in, the email address much contain the following “@” and “.” (basically has to be a valid email address, [email protected]) or you get an error message. If you enter the email address in correctly you should be taken back to the index page.Image on the right shows what happens when you enter an invalid email address, the image on the left shows what happens when you enter a valid email address.TimerDesign:- Separate document.Create:Header;script type=”text/javascript”;function timedText(){var t1=setTimeout(“document.getElementById(‘txt’).value=’1 Min!'”,60000);var t2=setTimeout(“document.getElementById(‘txt’).value=’2 Mins!'”,120000);var t3=setTimeout(“document.getElementById(‘txt’).value=’3 Mins!'”,240000);};/script;Form;form;;input type=”button” value=”Display timed text!” onclick=”timedText()” /;;input type=”text” id=”txt” /;;/form;Test:This screenshot shows the timer in action, after every minuet (up to three minuets) the timer shows a message telling you how long you have been on that page.Implementation of Web Page Scripts in Two Different Browsers – M3Not all browsers are able to implement scripts the same and the sear amount of browsers (and versions) makes it really hard to create a web page around a specific browser.As soon as you load a page that contains JavaScript you can see the differences in implementation between IE and FF straight away, Internet Explorer requires confirmation from you before it runs the script, Firefox on the other hand loads it right away. Yes there are a few security issues with Firefox automatically running scripts but you should never run into serious trouble.” Two hackers revealed that Mozilla Firefox’s JavaScript implementation is “a complete mess” by disclosing a flaw so serious it’s impossible to patch. A Mozilla representative at the event begged the hackers to turn in the 30 bugs they knew about for $500 per bug but the pair laughed at the offer.” – www.explodincigar.comInfact FF’s implementation of JavaScript was so bad they had to revamp their code.” The ActionMonkey project is about to start some important work in the Mozilla code: to merge SpiderMonkey, the current JavaScript implementation code with Tamari…….It’s worth noting that in Firefox’s case, JavaScript is relevant not only for its impact on RTA (rich web applications) but it will also have a deep impact in its performance as almost all its behavior is programmed in JavaScript as well………” – www.mozillalinks.orgThere are also many other problems with implementation of scripts in different browsers, the variation in colours (Some colours are completely different), text sizes and much more.Luckily, if you know what problems you are going to have with the implementation, there are various methods of getting past them. The best one in my opinion is to use a tweaked browser detection script, the script will find out what browser you are using and then load the page made for that browser.EG<script>var browserName = navigator.appNameif(browserName == “Mozilla Firefox”){window.location = “FF.html” // Loads the page made for Firefox}else{window.location = “IE.html” // Loads the page made for Internet Explorer}</scripShow how existing interactivity could be extended or additional interactivity introduced into a web page – D2Generally speaking everyone likes a interactive webpage and thanks to JavaScript it’s not that hard to do. There are so many things you could do to make your web page more interesting, ill give a few examples:Mouse over – When you move your mouse over a certain element of your webpage you can make it change (text, image, ect)Buttons – Everyone loves buttons, forward, back or even change the colour.Alerts – Messages that pops up to tell your visitors important information.Prompts – Like an Alert except they want input from you.Data Validation – Make sure your viewers input is correct by validating what’s been entered.Clocks – It’s always nice to know how much time you have wasted.Browser and OS detection – Simply shows you your OS and Browser info.Redirecting – This page no longer in use? No problem, redirect them to the new one.These are just a few example of how you would improve/create interactivity in your webpage.Below is an example of how you would change the background colour of your site, this not only adds the interactivity of the site but also helps people who have visual impairments, I chose red, green and white;form;;INPUT type=”button” value=”Change to Yellow!” name=”button3″ onClick=”document.bgColor=’green'”; ;br;;INPUT type=”button” value=”Change to Red!” name=”button4″ onClick=”document.bgColor=’red'”; ;br;;INPUT type=”button” value=”Change back!” name=”button5″ onClick=”document.bgColor=’white'”; ;/form;Evaluate the impact of using CSS to control layout – D3changing the layout of a webpage using HTML and tables can be a pain, not every browser loads them the same and breaking can occur. Fortunately when CSS was introduced

Leave a Reply

Your email address will not be published. Required fields are marked *

x

Hi!
I'm Heidi!

Would you like to get a custom essay? How about receiving a customized one?

Check it out