获取上一页关键词,带关键词到快商通进行对话

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<title>text</title>


</head>
<body>




  <textarea type="text" id="fswt_nr"  placeholder="请输入您的问题" name="text"></textarea>
  <input type="submit" value="发送" id="dyfs">
  
  
  
<script language="javascript">



    var url = window.location.href;//当前页面
    var shang=window.document.referrer; //来源上一页    
    var biaos=encodeURIComponent("自设入口");//标识
    
    if(shang.indexOf("word")!=-1){
        
        var k = window.document.referrer.split('word=')[1].split('&')[0];
        /*将关键词赋值给input*/ 
        document.getElementById("fswt_nr").value=decodeURIComponent(k);
        
                
        }else{
            

            }
                        

           /*进入页面后5秒跳转快商通*/    
        setTimeout("zjtiao()",25000);
            
        function zjtiao(){    
            var dyfs=document.getElementById("fswt_nr").value;
            KS.openChatWin({cv:dyfs,sText:'自设入口'});            
        }
        
    /*点击发送触发*/
    document.getElementById("dyfs").onclick=function(){
        var dyfs=document.getElementById("fswt_nr").value;        
        KS.openChatWin({cv:dyfs,sText:'自设入口'});
        
        }
         
</script>

<!--快商通官方链接-->
<script type="text/javascript" src="https://test.kuaishang.cn/bs/ks.j?cI=168168&fI=1136" charset="utf-8"></script>


</body>
</html>
转载请注明出处: 欢迎留言或qq(1090413588)交流
原文地址:https://www.cnblogs.com/linyusong/p/6999717.html