Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
web_flea_market
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
web_flea_market
Commits
4e6edbea
Unverified
Commit
4e6edbea
authored
Nov 30, 2022
by
pig40
Committed by
GitHub
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跳蚤市场js
parent
29140a4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
shop.js
flea_market/js/shop.js
+59
-0
No files found.
flea_market/js/shop.js
0 → 100644
View file @
4e6edbea
//书p169页, 4.添加JavaScript代码
//在body部分添加javascript代码
var
item
=
document
.
getElementsByClassName
(
"item"
);
//根据classname找到列表元素
//遍历所有列表项
for
(
var
i
=
0
;
i
<
item
.
length
;
i
++
){
//设置列表项移入,移除事件,改变列表项背景色
item
[
i
].
onmouseover
=
function
(){
this
.
style
.
background
=
'rgb(200,200,200)'
;
}
item
[
i
].
onmouseout
=
function
(){
this
.
style
.
background
=
'rgb(255,255,255)'
;
}
}
//第二阶段留言管理
function
SelectAll
(){
var
checkboxs
=
document
.
getElementsByName
(
'choose'
);
for
(
var
i
=
0
;
i
<
checkboxs
.
length
;
i
++
){
var
e
=
checkboxs
[
i
];
e
.
checked
=
e
.
checked
;
}
}
//JQuery动画效果 p211
$
(
document
).
ready
(
function
(){
$
(
'li'
).
each
(
function
(
index
){
$
(
this
).
hover
(
function
(){
$
(
'li'
).
anmite
({
width
:
100
},
500
);
$
(
'li'
).
eq
(
index
).
anmite
({
width
:
200
},
500
);
});
});
});
//p235 表单数据提交
var
goods
=
{
name
:
""
,
price
:
""
,
information
:
""
,
};
function
upload
(){
goods
.
name
=
document
.
getElementsById
(
"name"
).
value
;
goods
.
price
=
document
.
getElementsById
(
"price"
).
value
;
goods
.
information
=
document
.
getElementsById
(
"information"
).
value
;
if
(
goods
.
name
==
""
||
goods
.
price
==
""
||
goods
.
information
==
""
)
{
alert
(
"商品信息不完全"
);
return
;
}
console
.
log
(
goods
);
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment