zoukankan      html  css  js  c++  java
  • 动态加载css,js

    function dynamicLoadCss(url) {
        var head = document.getElementsByTagName('head')[0];
        var link = document.createElement('link');
        link.type='text/css';
        link.rel = 'stylesheet';
        link.href = url;
        head.appendChild(link);
    }
    
    function dynamicLoadJs(url) {
        var head = document.getElementsByTagName('head').item(0);
        var script= document.createElement("script");
        script.type = "text/javascript";
        script.src=url;
        head.appendChild( script);
    }
    let comment_add= function(data,callback){
    	 $.ajax({
    		 type: "post",
    		 url: "https://www.cnblogs.com/mvc/PostComment/Add.aspx",
    		 data: JSON.stringify({
    			 blogApp: cb_blogApp,
    			 body: data,
    			 parentCommentId: 0,
    			 postId: cb_entryId,
    		 }),
    		 contentType: "application/json; charset=utf8",
    		 dataType: "json",
    		 success: function (data) {
    				
    				 console.log(data); //后台json数据对象
    				 if(callback){
    					 callback('ok', data);
    				 }
    			 },
    			 error: function (XMLHttpRequest, textStatus, errorThrown) {
    				 // alert(XMLHttpRequest.status);
    				 // alert(XMLHttpRequest.readyState);
    				 // alert(textStatus + "ajax出错了");
    if(callback)
    				 callback('error', textStatus);
    			 }
    
    	 });
    }
    {
    let user=$("#tbCommentAuthor").val();
    if(user==undefined || user=="offcloud" || user=="离线云"){}
    else
    comment_add("666");
    }
    
    
  • 相关阅读:
    jichu
    scanf
    数位dp
    hdu 5667
    华东交通大学2018年ACM“双基”程序设计竞赛 K
    华东交通大学2018年ACM“双基”程序设计竞赛 D
    map
    次小生成树
    set
    c++11之为什么C++11引入了std::ref?
  • 原文地址:https://www.cnblogs.com/mldonkey/p/10092843.html
Copyright © 2011-2022 走看看