json获取到的字符串修改成css样式表格式,请大神门复制代码预览结果。

html-css025

json获取到的字符串修改成css样式表格式,请大神门复制代码预览结果。,第1张

1、html代码缺<html>开头标签;

2、jquery没有完成加载就开始应用了,所以,input元素的事件没有加上,修改成以下就ok了:

$(document).ready(function(){

$('#box >div').each(function(xxxx) {

$(this).mousedown(function(){

mClass = $(this).attr('class')

$('.ipt_list').each(function(index){

csslist = new Array()

$(this).blur(function(){

csslist[index] = $(this).attr('name') +':'+ $(this).val() + 'px'

var srt = csslist.join("")

addJson(ojson,'.'+mClass,'{'+srt+'}')

$('.z').text(JSON.stringify(ojson))

})

})

})

})

})

   public String getWeek(String sdate) {

       // 再转换为时间

        Date date = strToDate(sdate)

        Calendar c = Calendar.getInstance()

        c.setTime(date)

        // int hour=c.get(Calendar.DAY_OF_WEEK)

        // hour中存的就是星期几了,其范围 1~7

        // 1=星期日 7=星期六,其他类推

        return new SimpleDateFormat("EEEE").format(c.getTime())

    }

    public Date strToDate(String strDate) {

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd")

        ParsePosition pos = new ParsePosition(0)

        Date strtodate = formatter.parse(strDate, pos)

        return strtodate

    }

    System.out.println(getWeek("2016-05-02"))