以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]调用天气插件 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=113906) |
-- 作者:l1q2lq -- 发布时间:2018/1/25 10:11:00 -- [求助]调用天气插件 此主题相关图片如下:360截图20180125100825898.jpg 此主题相关图片如下:360截图20180125100812407.jpg 如图的动态天气插件能否在FT里调用,能否提供个例子 <script>(function(T,h,i,n,k,P,a,g,e){g=function(){P=h.createElement(i);a=h.getElementsByTagName(i)[0];P.src=k;P.charset="utf-8";P.async=1;a.parentNode.insertBefore(P,a)};T["ThinkPageWeatherWidgetObject"]=n;T[n]||(T[n]=function(){(T[n].q=T[n].q||[]).push(arguments)});T[n].l=+new Date();if(T.attachEvent){T.attachEvent("onload",g)}else{T.addEventListener("load",g,false)}}(window,document,"script","tpwidget","//widget.seniverse.com/widget/chameleon.js"))</script> <script>tpwidget("init", { "flavor": "bubble", "location": "WX4FBXXFKE4F", "geolocation": "enabled", "position": "top-right", "margin": "10px 10px", "language": "zh-chs", "unit": "c", "theme": "chameleon", "uid": "U429F2B225", "hash": "f780804b70756d0fe2c18c9089686fce" }); tpwidget("show");</script> |
-- 作者:有点甜 -- 发布时间:2018/1/25 10:22:00 -- 参考 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=49907&skin=0
|
-- 作者:l1q2lq -- 发布时间:2018/1/25 10:31:00 -- 链接这个已经看过,但是怎么能够做到:动态显示,也就是WEB控件跟随示天气插件自适应大小 [此贴子已经被作者于2018/1/25 10:31:40编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/1/25 10:33:00 -- 以下是引用l1q2lq在2018/1/25 10:31:00的发言:
链接这个已经看过,但是怎么能够做到:动态显示,也就是WEB控件跟随示天气插件自适应大小
你把web控件改成和天气插件大小一致,才行的。 |
-- 作者:l1q2lq -- 发布时间:2018/1/25 10:36:00 -- 我试试,有问题再来请教 |
-- 作者:l1q2lq -- 发布时间:2018/1/25 11:28:00 -- 老师,ylm版主的那个天气例子显示语法错误,麻烦帮忙看一下 Dim D As Date Dim XMLH As Object XMLH = CreateObject("Microsoft.XMLHTTP") Dim drs As List(Of DataRow) = DataTables("表A").Select("代码 is not null") For Each dr As DataRow In drs XMLH.open("GET", "http://www.weather.com.cn/data/sk/" & dr("代码") & ".html", True) \'获得实时信息 XMLH.send(Nothing) Do While XMLH.readyState <> 4 Application.DoEvents Loop \'把数据json数据转化成对象 Dim json As String = XMLH.responseText Dim ScriptControl As Object, data As Object, JscriptCode As String JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}" ScriptControl = CreateObject("MSScriptControl.ScriptControl") With ScriptControl .Language = "Javascript" .Timeout = -1 .AddCode(JscriptCode) data = .Run("toObject", json) End With dr("城市") = data.weatherinfo.city dr("实时_气温") = data.weatherinfo.temp dr("实时_风向") = data.weatherinfo.WD dr("实时_风速") = data.weatherinfo.WS dr("实时_更新时间")=data.weatherinfo.time dr("实时_湿度")=data.weatherinfo.SD \'---------------------------------------------------------------------------------- XMLH.open("GET", "http://m.weather.com.cn/atad/" & dr("代码") & ".html", True) \'获得预报信息 XMLH.send(Nothing) Do While XMLH.readyState <> 4 Application.DoEvents Loop \'把数据json数据转化成对象 json = XMLH.responseText JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}" ScriptControl = CreateObject("MSScriptControl.ScriptControl") With ScriptControl .Language = "Javascript" .Timeout = -1 .AddCode(JscriptCode) data = .Run("toObject", json) End With dr("今天_气温") = data.weatherinfo.temp1 dr("今天_天气") = data.weatherinfo.weather1 dr("今天_风速") = data.weatherinfo.wind1 dr("今天_图标") = data.weatherinfo.img1 dr("今天_图标2") = data.weatherinfo.img2 dr("明天_气温") = data.weatherinfo.temp2 dr("明天_天气") = data.weatherinfo.weather2 dr("明天_风速") = data.weatherinfo.wind2 dr("明天_图标") = data.weatherinfo.img3 dr("明天_图标2") = data.weatherinfo.img4 dr("后天_气温") = data.weatherinfo.temp3 dr("后天_天气") = data.weatherinfo.weather3 dr("后天_风速") = data.weatherinfo.wind3 dr("后天_图标") = data.weatherinfo.img5 dr("后天_图标2") = data.weatherinfo.img6 dr("第4天_气温") = data.weatherinfo.temp4 dr("第4天_天气") = data.weatherinfo.weather4 dr("第4天_风速") = data.weatherinfo.wind4 dr("第4天_图标") = data.weatherinfo.img7 dr("第4天_图标2") = data.weatherinfo.img8 dr("第5天_气温") = data.weatherinfo.temp5 dr("第5天_天气") = data.weatherinfo.weather5 dr("第5天_风速") = data.weatherinfo.wind5 dr("第5天_图标") = data.weatherinfo.img9 dr("第5天_图标2") = data.weatherinfo.img10 dr("第6天_气温") = data.weatherinfo.temp6 dr("第6天_天气") = data.weatherinfo.weather6 dr("第6天_风速") = data.weatherinfo.wind6 dr("第6天_图标") = data.weatherinfo.img11 dr("第6天_图标2") = data.weatherinfo.img12 dr("更新日期") = data.weatherinfo.date_y dr("星期") = data.weatherinfo.week dr("今天_穿衣指数") = data.weatherinfo.index_d dr("今天_紫外线") = data.weatherinfo.index_uv dr("今天_洗车指数") = data.weatherinfo.index_xc dr("今天_旅游指数") = data.weatherinfo.index_tr dr("今天_空气舒适度") = data.weatherinfo.index_co dr("今天_晨练指数") = data.weatherinfo.index_cl dr("今天_晾晒指数") = data.weatherinfo.index_ls dr("今天_过敏指数") = data.weatherinfo.index_ag D=dr("更新日期") Next With DataTables("表A") .DataCols("第4天_气温").Caption =D.AddDays(3) & "_气温" .DataCols("第4天_天气").Caption =D.AddDays(3) & "_天气" .DataCols("第4天_图标").Caption =D.AddDays(3) & "_图标" .DataCols("第4天_图标2").Caption =D.AddDays(3) & "_图标2" .DataCols("第4天_风速").Caption =D.AddDays(3) & "_风速" .DataCols("第5天_气温").Caption =D.AddDays(4) & "_气温" .DataCols("第5天_天气").Caption =D.AddDays(4) & "_天气" .DataCols("第5天_图标").Caption =D.AddDays(4) & "_图标" .DataCols("第5天_图标2").Caption =D.AddDays(4) & "_图标2" .DataCols("第5天_风速").Caption =D.AddDays(4) & "_风速" .DataCols("第6天_气温").Caption =D.AddDays(5) & "_气温" .DataCols("第6天_天气").Caption =D.AddDays(5) & "_天气" .DataCols("第6天_图标").Caption =D.AddDays(5) & "_图标" .DataCols("第6天_图标2").Caption =D.AddDays(5) & "_图标2" .DataCols("第6天_风速").Caption =D.AddDays(5) & "_风速" .BuildHeader() End With Dim btn As WinForm.Button =e. Form.Controls("Button2") btn.PerformClick() |
-- 作者:有点甜 -- 发布时间:2018/1/25 11:38:00 -- 天气预报信息的获取,现在基本没有免费的了。免费的基本都不稳定,论坛里面的那些接口全部都无效了。 |
-- 作者:有点甜 -- 发布时间:2018/1/25 11:54:00 -- 或者你可以试试这个接口
http://www.sojson.com/api/weather.html
Dim cs As String = "湛江" |
-- 作者:qwz405 -- 发布时间:2018/4/12 10:37:00 -- 学习 |