Web Development(part1) – JavaScript

Pushy Menu

螢幕快照 2018-09-13 下午3.35.08.png

You can download from the website.
You need to add content, overlay, pushy JS, jQuery, and Pushy Css part to  integrate in your website.

JavaScript language teaching

  1. Structure
  2. Object and Method
  3. Variable and Data Type
  4. Operator
  5. Function
  6. Event
  7. Flow Control

  • Structure
There are some elements in the website like window and navigator which contain other elements. You can call these elements by using upper object like document.

螢幕快照 2018-09-13 下午3.49.20.png

You probably confuses about what it works. I will tell the details in this example(Hello World).
document.write(“Hello World!");
<noscript>
Your browser doesn’t support JavaScript language
</noscript>

You can change former 3 lines into below type.

src="https://www.abc1234567.com/123.js">
  • Objects,Methods, and Properties

Document is a object and write is a method.

<form name="my_form">
            <input type="text" name="my_name" value="Your name here">
</form>
document.my_form.myname
my_form is form’s object name and my_name is words typing in form.
You can use it to access the content of the form because the objects contain forms which contain name property.

So we temporarily conclude the following codes.

Method like Object_name.method()
Property like Object_name.property
   document.wrtie(“URL:" + document.URL + "
" + “Last Modified:" + document.lastModified +"
" + “Title:" + document.title +"
" + “Background Color:" +  document.bgColor + "
" +"Text Color" + “document.fgColor"+"
“);

By the way

<br> -> It is a carrier return to change line in printing words.
+ -> It can help different type like string and variable to print together.
; -> We need add semicolon in the last word in each line.
  • Variable and Data Type

We use variable to access value, string, and other data types to help us deal with problems simply.

var my_name = “Portran";

Data Type -> String(“Portran"), Number(19), Bollean(true, and false), Null(var no_content),Object(document.myform.myname), Array(new Array(2,4,6,7,9))

Array

var arr_name= new Array;
=new Array(length);
=new Array(data1,data2,data3,…,dataN);

Example

var student_name=new Array(“Peter","Pig","Pineapple");
var student_age=new Array(student.length);
var i;
for(i=0;i
student[i]=15+i;
document.write(“Student name:"+student_name[i]+",Student age:"+student_age[i]+"
“);
}
for -> it means loop which it iteratively carries out judge in condition.
  • Operator

There are seven types like Arithmetic(+,++,-,–,*,/,%(get remainder)), String(+,+=), Logical(&&(and),||(or),!(opposite)), Bitwise(&,|,^,~(opposite),<<(multiply 2 power),>>(divide 2 power)), Assignment(=,+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=), Comparison(==,!=,>,>=,<,<=), Special(?:) Operators.

Special-> condition? experiment1:experiement2

Event

 

Dealing event:

 

 

Reference

 


 

JavaScript初階教學

PondDing

發表留言

透過 WordPress.com 建置的網站.

向上 ↑

Yosing'sDailyPractice

是練習,也是實踐

portran

Explore the life truth and beauty

使用 WordPress.com 設計專業網站
立即開始使用