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.

huong
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. Lecture 7: JavaScript 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.

  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 7: JavaScript

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

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

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

  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: var lbl = document.getElementById("Label1"); var tmp = lbl.innerHTML; lbl.innerHTML = lbl.title; lbl.title = tmp; Lecture 7: JavaScript

  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 7: JavaScript

More Related