甲钴胺不能和什么药一起服用| 肛门潮湿是什么情况| 百香果有什么营养| 哈气是什么意思| 王晶为什么不娶邱淑贞| 自身免疫性胃炎是什么意思| 囊性灶是什么意思| 柏拉图之恋是什么意思| 1993年属什么| 降压药有什么副作用| 猪脆肠是什么器官| 什么叫蜘蛛痣| 痄腮是什么意思| 多囊什么意思| 什么是麻疹| 特别能睡觉是什么原因引起的| 婚动是什么意思| 促甲状腺素高是什么原因| 道士是什么生肖| 亚麻酸是什么东西| 胡萝卜炒什么好吃| 骨皮质断裂是什么意思| 淋巴细胞数高说明什么| 眼睛胀疼是什么原因| 什么叫增强ct| 头晕在医院挂什么科| 五福临门是什么意思| 吃什么减脂肪| 经常便秘吃什么| 北京市市长是什么级别| 不硬的原因是什么| 肠胃炎吃什么药| 乌冬面是什么面| pacs什么意思| 懦弱的反义词是什么| 水肿吃什么药消肿最快最有效| 秋收冬藏是什么生肖| 更年期是什么意思| 天秤座男生和什么星座最配| 绒穿和羊穿有什么区别| 什么样的人容易得脑梗| 赤小豆和红豆有什么区别| 吹空调嗓子疼吃什么药| 为什么会得子宫肌瘤| 加湿器有什么作用| 菊花什么颜色| 眼睛肿是什么原因| 喝中药不能吃什么东西| 男人经常熬夜炖什么汤| 是什么意思啊| 机能鞋是什么意思| 神父和修女是什么关系| 为什么井盖是圆的| 跟风是什么意思| 男生下巴长痘痘是什么原因| 什么是海啸| 病理单克隆抗体检测是什么| 嘴唇起白皮是什么原因| 为什么健身| 石棉是什么| 什么病不能坐飞机| 尿分叉是什么原因| 急性扁桃体炎什么原因导致的| 什么叫换手率| 七情六欲指的是什么| 什么月披星| 龟头起红点用什么药| 什么样的山| 手腕关节疼痛什么原因引起的| 藿香正气水什么味道| 胸闷出汗是什么原因| 简历照片用什么底色| 拔牙吃什么消炎药| 儿童枕头用什么枕芯好| 营养神经吃什么药效果好| 肾水不足是什么意思| 迎风流泪用什么眼药水| 胡说八道是什么意思| 痛风吃什么水果好| 六角龙吃什么食物| 不完全性右束支传导阻滞是什么意思| 珙桐属于什么植物| 白带多是什么情况| 包皮过长有什么危害| 蛇信子是什么| 9.7号是什么星座| 宝宝什么时候可以吃盐| 痱子是什么样的图片| 车厘子是什么季节的| 250是什么意思| 惯犯是什么意思| 橘络的功效与作用是什么| 早餐做什么| 高压高是什么原因引起的| 那天离开你是什么歌| 四月27日是什么星座| 聿字五行属什么| 什么是津液| 牛肉粉是什么调料| 吃什么会食物中毒| tb是什么| 什么是痔疮早期图片| 1月23日是什么星座| 人体最大的免疫器官是什么| 氨气是什么| 安五行属性是什么| 脚底出汗是什么原因女| 乳腺实性结节是什么意思| furk是什么意思| 梦见情人是什么意思啊| 女方起诉离婚需要什么证件| 阴历三月是什么星座| 七夕节是什么节日| 猴子捞月是什么生肖| 十月十一日是什么星座| 4月22日是什么星座| 梦见上班迟到什么意思| 脚掌心发热是什么原因| 阳历6月28日是什么星座| l代表什么单位| 艺体生是什么意思| 月亮五行属什么| 防晒霜什么牌子好| 身上长湿疹是什么原因导致| 双肾钙化灶是什么意思| 头发白是什么原因引起的| 酸碱度是什么意思| 磨平了棱角是什么意思| 窦性心律左室高电压什么意思| 点到为止是什么意思| 精神什么满| 血氧低有什么症状| 经常熬夜吃什么好| 5月24日什么星座| 纳征是什么意思| 多酚是什么| 男大三后面一句是什么| 龙的五行属性是什么| 车水马龙的意思是什么| 父亲节送什么| 过期的牛奶有什么用途| 白细胞和淋巴细胞偏高是什么原因| 自然人是什么意思| 小便发黄是什么原因引起的| 甲钴胺治疗什么病| 毛发旺盛女生什么原因引起的| 肝内脂肪浸润是什么意思| 小孩不说话什么原因| 手上为什么长湿疹| 陶氏腔积液是什么意思| 梦到装修房子是什么征兆| 比围是什么| 为什么想吐却吐不出来| 补气血吃什么中成药最好| 心脏窦性心律什么意思| 干预治疗是什么意思| 落寞是什么意思| 伤风胶囊又叫什么| 花孔雀是什么意思| 气胸吃什么药| 痛风吃什么好| 野合什么意思| 章鱼吃什么食物| 过敏性结膜炎用什么眼药水最好| 右手大拇指抖动是什么原因| 叶子为什么是绿色的| 退烧吃什么药好| 什么叫肾功能不全| 95开头的是什么电话| 头发少剪什么发型好看| 断奶吃什么药| 金字旁加匀念什么| 癸酉五行属什么| 痛风什么东西不可以吃| 枯木逢春什么意思| 胃胀气是什么症状| 受凉胃疼吃什么药| 天蝎女和什么星座最配| 艾滋病皮肤有什么症状| 韭菜补什么| 黄柏泡水喝有什么功效| 处女座跟什么星座最配| 血管堵塞用什么药| 四五行属什么| 甲胎蛋白是什么意思| 讣告什么意思| 两什么三什么| 小儿病毒性感冒吃什么药效果好| 蜱虫长什么样子图片| 大豆磷脂是什么| 痛风能吃什么菜| 吃核桃有什么好处| 梦见老人死了又活了是什么意思| 唐朝为什么灭亡| 不妄作劳什么意思| 木牛流马是什么意思| 老人头发由白变黑是什么原因| 萎靡是什么意思| 为什么会甲状腺肿大| 势在必得是什么意思| 咳嗽咳白痰是什么症状| 什么叫十二指肠球炎| 绅士是什么意思| 耳道发炎用什么药| 06年是什么年| 吃什么去湿气| 女人颧骨高有什么说法| 骨皮质扭曲是什么意思啊| 什么是日间手术| 车水马龙是什么生肖| 后脑勺白头发多是什么原因| 舌吻什么感觉| 看结石挂什么科室| g18k是什么金| 心慌手抖是什么原因| 经常吃辣椒有什么好处和坏处| 脚抽筋是什么原因引起的| 法兰绒是什么面料| 王是什么生肖| 一如既往的意思是什么| 空调买什么牌子好| 甲亢和甲状腺有什么区别| 清水是什么意思| 医院的特需门诊是什么意思| 六月初十是什么日子| 公鸡为什么会打鸣| 女性尿特别黄是什么原因| cfa是什么证书| 女人脚肿是什么原因| smile是什么牌子| 疤痕增生挂什么科| 过敏性鼻炎引起眼睛痒用什么药| 洗手做羹汤是什么意思| 男人补锌有什么好处| 埃及的母亲河是什么| 厘清是什么意思| 刀口力念什么| 小老弟是什么意思| 枸杞与菊花一起泡水喝有什么功效| 脑梗是什么病| 豆瓣酱可以做什么菜| 妇科湿疹用什么药膏最有效| 荷尔蒙是什么意思| 灵芝有什么作用与功效| syp是什么意思| ala是什么| 阴囊潮湿用什么药| 扶他是什么意思| 血压低会出现什么症状| 松花粉有什么功效| 喉咙痛咽口水都痛吃什么药| 马骝是什么意思| 荔枝有什么寓意| 熟普属于什么茶| 双向情感障碍是什么意思| 什么是胆固醇| 杨贵妃长什么样| 两个虎是什么字| 内痔吃什么药| 国际劳动日是什么生肖| 粉蒸肉的粉是什么粉| 嗫嚅是什么意思| 湿疹是由什么引起的| bacardi是什么酒| 百度Jump to content

文娱 体育--上海频道--人民网

From Wikiversity
百度 区级行政权力事项调整目录在区政府政务网、区机构编制委员会办公室网公布。

Basic JavaScript is a course under the topic of JavaScript.

What you should know - HTML/XHTML

Basics -

  • JavaScript is the most popular web page scripting language and is supported by almost every browser.
  • It adds interactivity to your web pages.
  • You can use only the tools already on your computer without the need to download any software.
  • JavaScript uses the user's computer ("client")'s resources, not the server's resources. (The server is the big remote computer the web site is permanently hosted.) In other words, if the JavaScript program says a computation is to be made, the user's computer will do it.
  • It is easy.

First Lesson

HTML scripts

Open up your text editor of choice and create a basic page (a basic note pad works great). Now I am going to teach you how to write on your webpage using JavaScript. Type the following into your text editor:

<html>
        <head><title>Hello World!</title></head>
 	<body>
 		<script type="text/javascript">
document.write('Hello World!');
 		</script>
       </body>
</html>

As you can see, our JavaScript instruction (document.write('Hello World!');) is added directly into your HTML by adding the <script> tag. Now save the text file with an HTML file extension. Use the "save as" function for your text editor and change the filename from something like "New Text Document.txt" to "Hello World.html". Use the .html in place of the .txt, .doc, .rtf, etc... Open your newly saved file in a browser. If all went well "Hello World!" will display in your browser as HTML content. If not, perhaps set your computers folder options to show filename extensions. Javascript and filename changes are not always available (by default).

To start off with, the <script type="text/javascript"> tag tells the browser that whatever comes between that tag and the coming </script> tag is script, and the type="text/javascript" tells it that it is JavaScript. Similarly, to use VBScript, you might use type="text/vbscript" instead of "text/javascript". For the purposes of this course, though, you should only ever need to use the JavaScript tag.

It is also important to note that the <script> tag is case sensitive. What this means is if you use lowercase letters in the tag, all the letters in the tag must be lowercase, and uppercase if you use any uppercase. For example, if you wrote

<ScRiPt TyPe="TeXt/JaVaScRiPt">

Not only would you waste a lot of time typing, but you would also confuse your browser.
You are probably wondering when I'm going to explain the rest of what you did. Well, document.write() is the JavaScript standard for writing text to the browser window. The 'document' clause refers to the HTML webpage (termed a document) as a whole; what follows ('.write()') is a command for the document object to carry out. In this case, you told the page to write the classic "Hello World" to the screen.

Second Lesson

This second lesson will introduce the topics of variables and operators.

Variables

One of the things JavaScript is used for is the manipulation of data. In JavaScript, pieces of data can be stored either in variables or arrays.

Variables are declared using the var keyword:

var numValue;
var textValue;
var binaryValue;

and can be given values when they are created:

var numValue = 3;
var textValue = "This is text.";
var binaryValue = true;

Multiple variables can even be declared at the same time:

var numValue = 3, textValue = "This is text.", binaryValue = true;

Variables in JavaScript are weakly typed, meaning that the types of individual variables are not determined by the programmer. Unlike many languages, JavaScript only provides a generic var rather than separate types for integers, floating point numbers, characters, and strings. For example, in the statement

var x = 0;

it is fairly obvious to any individual reading the code that x is a number. However, if the statement

x = x + "This is text that is probably not a number";

were to appear later in the code, JavaScript would change the variable to a text variable. This is one of the reasons that JavaScript is referred to as weakly typed; at any particular point in time, it is impossible to tell exactly what type a particular variable is.

Arrays

Arrays in most languages are a means of collecting variables so that they can be referred to by an index. This is usually a numerical index beginning at 0(i.e., 0,1,2,...), but does not necessarily have to be a number. Arrays are declared in several ways; they can be declared either explicitly, indicating the number of variables in the array:

var colors = new Array(7);

or not:

var colors = new Array();

In the last case, the programmer leaves the number of colors open-ended. This may allow them to be more flexible in the long run.

To use a particular variable within the array, simply indicate the index of the element using brackets:

colors[2] = "orange";
x = colors[7] ;
z = "The book's color is " + colors[5] + ".";


It was mentioned before that arrays can use indexes other than numbers. One example of this might be using an index based on text instead of numbers. We might wish to index on the names of various fruits to get their colors:

colors["lemon"] = "yellow";
colors["lime"] = "green";
colors["cherry"] = "red";

Programs can be made significantly more readable using this feature.

document.write("The color of a cherry is " + colors["cherry"]
                    + ", but the color of a lime is " + colors["lime"]);

Operators


Arithmetic Operators

Operator Description Example Result
+ Addition x = 2

y = 2

x + y

4
- Subtraction x = 5

y = 2

x - y

3
* Multiplication x = 5

y = 4

x * y

20
/ Division 15 / 5

5 / 2

3

2.5

% Modulus (division remainder) 5 % 2

10 % 8

10 % 2

1

2

0

++ Increment x = 5

x++

6
--

(two adjacent hyphens)

Decrement x = 5

x--

4

Assignment Operators

Operator Example Is The Same As
= x = y x = y
+= x += y x = x + y
-= x -= y x = x - y
*= x *= y x = x * y
/= x /= y x = x / y
%= x %= y x = x % y

Comparison Operators

Operator Description Example
== is equal to 5 == 8 returns false
=== is equal to (checks for both value and type) x = 5

y = "5"

x == y returns true

x === y returns false

!= is not equal 5 != 8 returns true
> is greater than 5 > 8 returns false
< is less than 5 < 8 returns true
>= is greater than or equal to 5 >= 8 returns false
<= is less than or equal to 5 <= 8 returns true

Logical Operators

Operator Description Example
&& and x = 6

y = 3

(x < 10 && y > 1) returns true

|| or x = 6

y = 3

(x == 5 || y == 5) returns false

! not x = 6

y = 3

!(x == y) returns true

String Operator

The string operator is used to concatenate two strings together. For example:

 var x = "Hello " + "world!" 

The above example would result in the variable x equaling "Hello world!".

Conditional Operator

JavaScript also contains a conditional operator that assigns a value to a variable based on some condition.

The syntax would be:

 variablename = ( condition ) ? value1 : value2 

For example:

 greeting = ( visitor == "PRES" ) ? "Dear President " : "Dear " 

value1 is the value of the expression if "condition" is fulfilled. value2 is its value in the case "condition" is not fulfilled. In the previous example, this value is stored in the variable "greeting". In the above example the browser checks to see if the variable visitor is set to PRES. If it is, it sets greeting to Dear President. If it is not, it sets greeting to Dear.

人民检察院是国家的什么机关 女燕读什么 天气热吃什么解暑 什么是肇事逃逸 ca199检查是什么意思
芝麻吃多了有什么坏处 夏天种什么水果 吃莲子有什么好处 动物都有什么 为什么想吐却吐不出来
医保乙类是什么意思 什么是氨基酸 肾结石发作有什么症状 睡觉爱做梦是什么原因 女人做梦梦到蛇是什么意思
喝什么水解酒 为什么怀不上孕 什么是轻断食 百折不挠的意思是什么 furk是什么意思
传导阻滞是什么意思jinxinzhichuang.com 什么星hcv9jop2ns3r.cn 胜字五行属什么hcv8jop4ns9r.cn 尿道感染用什么药hlguo.com 80属什么hcv9jop6ns4r.cn
造影有什么危害hcv9jop0ns6r.cn 猪苓是什么东西hcv8jop7ns7r.cn 胆固醇是什么hcv9jop4ns8r.cn 看见蛇过马路什么征兆hcv9jop3ns9r.cn 心率过快吃什么药最好hcv7jop9ns8r.cn
中风吃什么药好hcv7jop5ns4r.cn 蛆长什么样hcv9jop5ns1r.cn 什么是白肉hcv8jop1ns9r.cn 樱桃是什么季节的水果hcv8jop0ns3r.cn 归脾丸的功效与作用治什么病hcv9jop6ns8r.cn
宫腔内稍高回声是什么意思hcv8jop8ns3r.cn 阿胶有什么功效hcv8jop9ns6r.cn 指甲挂什么科hcv9jop2ns4r.cn 三更是什么生肖hcv8jop5ns0r.cn 史密斯夫妇是什么意思hcv9jop0ns4r.cn
百度