网页设计外文翻译
网页设计外文翻译
网页设计外文翻译
外文原文
Source: Web Page Design Using JavaScript
THE BASICSﻭ JAVASCRIPT uses a subset ofl then the variable named answer has a value of false。 You can then use an if statement in the JavaScript code to respond appropriately.
var answer = confirm ("Are you sure you want to quit?")ﻭif (answer==true)ﻭ{ﻭ
网页设计外文翻译
网页设计外文翻译
网页设计外文翻译
()ﻭ}
The following code will pop up a dialog box that asks the user to enter some sort of information. If the user clicks OK the information they entered is stored in the variable。 The second set of quotation marks inside of the prompt statement make the contents of the text box blank when the dialog box is displayed。
var response = prompt (”What is your name?” ,””)
document。write ("〈font size=7 color=red face=arial〉Hello ” + response + ”!")
Notice that in the last two examples the window and document objects were used。 Window refers to the browser window and document refers to the page being displayed. The use of a dot after the name of the object allows actions to be performed on that object or properties of that object to be modified. In this next example, the navigator object is referenced in order to display the browser name and version.
alert ("You are using " + navigator。appName + " version " + navigator。appVersion + ”.")
POP—UP WINDOWS
An additional browser window may be opened using a simple JavaScript. The open method contains three parts as in the following example: the name of the document or url of the web site to be displayed in the new window, the name that may be used to refer to the browser window (requires more code than is shown here), and the properties of the new window。 Please note that the properties are all listed in one set of quotation marks and are separated by commas.
open ("my", ”mywin", "height=200, width=200, titlebar=false”)
The following properties may be used to control the appearance of the new window:
Table1—1 properties may be used to cont
网页设计外文翻译 来自淘豆网www.taodocs.com转载请标明出处.