1 / 8

JavaScript

JavaScript. Client Side Processing. JavaScript. JavaScript runs in the browser (the client) JavaScript programs do not need to access the server. JavaScript programs can change the content and the appearance of a page. Using onload.

sai
Download Presentation

JavaScript

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. JavaScript Client Side Processing

  2. JavaScript • JavaScript runs in the browser (the client) • JavaScript programs do not need to access the server. • JavaScript programs can change the content and the appearance of a page. Lecture 8: JavaScript

  3. Using onload • The JavaScript onload is different to the C# Page_Load. It happens at the client: • Include this line in the <source> view of your page: <body onload="ol()"> • It will make the page run the JavaScript function ol Lecture 5: Review

  4. backgroundColor • You can set the background-color most elements: function ol(){ document.body.style.backgroundColor="red"; } Lecture 5: Review

  5. setInterval • You can use setInterval to make a function happen regularly. • Usually you call setInterval in onload function ol(){ setInterval(flipText,1000); } Lecture 5: Review

  6. getElementById • If an HTML element has an ID set you can find it and change it from JavaScript: varlbl = document.getElementById("Label1"); lbl.innerHTML= "Andrew was here"; Lecture 5: Review

  7. ToolTip and title • The ToolTip property in Visual Studio can be used to “hide” information that you show later. • You can swap innerHTML and title: varlbl = document.getElementById("Label1"); vartmp = lbl.innerHTML; lbl.innerHTML= lbl.title; lbl.title= tmp; Lecture 5: Review

  8. Summary • JavaScript is different to C# • Many things are similar. • JavaScript runs at the client, C# runs at the server. • It can be difficult to debug JavaScript Lecture 5: Review

More Related