为了账号安全,请及时绑定邮箱和手机立即绑定

怎么吧js这段修改为jQuery 如图

怎么吧js这段修改为jQuery 如图

qq_花开花谢_0 2018-11-06 09:04:44
查看完整描述

1 回答

?
不负相思意

TA贡献1777条经验 获得超10个赞

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

$(function(){

                var s = $("#pingStar");

                m = $("#dir");

                n = $(s).find("li");

                input = $("#startP");

                input.val(-1);

                 

                clearAll = function() {

                    for(var i = 0; i < n.length; i++) {

                        n[i].className = "";

                    }

                };

                 

                for(var i = 0; i < n.length; i++) {

                    n[i].onclick = function() {

                        var q = $(this).attr("rel");

                        clearAll();

                        input.val(q);

                        for(var i = 0; i < q; i++) {

                            n[i].className = "on";

                        }

                        m.html($(this).attr("title"));

                    };

                     

                    n[i].onmouseover = function() {

                        var q = $(this).attr("rel");

                        clearAll();

                        for(var i = 0; i < q; i++) {

                            n[i].className = "on";

                        }

                        m.html($(this).attr("title"));

                    };

                     

                    n[i].onmouseout = function() {

                        clearAll();

                        for(var i = 0; i < input.value; i++) {

                            n[i].className = "on";

                        }

                        if(input.val() == -1) {

                            m.html("请选择分数");

                        } else {

                            m.html(n[input.value - 1].title);

                            //m.innerHTML = input.title; 

                        } 

                    }

                }

                 

            })

             

            //如果有什么问题 就把对象用$()框起来

            例如

             input = $("#startP");

                $(input).val(-1);

 


查看完整回答
反对 回复 2018-11-16
  • 1 回答
  • 0 关注
  • 471 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信