Nie bardzo mi to wychodzi to co podałeś.
Znalazłem inny sposób, jest to przykładowy kod, pobiera dane z pliku, ale jeśli zawartość pliku ulegnie zmianie to się nic zmienia w windgecie, dane są takie jak przy jego pierwszym uruchomieniu.
dane są pobierane z
http://www.inik.pl/data.phpjest w nim wynik funkcji php time()
i w widgecie jest cały czas jedna wartość wyświetlana wzięta przy pierwszym uruchomieniu, ile razy bym nie uruchomił ponownie widgeta to nadal jest to sama wartość
macie pomysł jak temu zaradzić? Dlaczego po jego ponownym uruchomieniu nie jest pobierana nowa zawartość pliku?
.styDefault {
color: #999999;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.styTextBox {
color: #000000;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:1px;
border:1px;
vertical-align:top;
}
.styButton {
color: #000000;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:0px;
margin-left:2px;
border:1px;
vertical-align:top;
}
.styImage {
color: #000000;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:0px;
margin-top:0px;
margin-left:0px;
border:0px;
vertical-align:top;
cursor:pointer;
}
.styTable {
color: #999999;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: white;
border-width: 0px;
border-spacing: 0px;
border-style: outset;
border-color: white;
border-collapse: separate;
table-layout:fixed;
}
.styBody {
background-image: url(images\\bckgrnd.png);
background-repeat: no-repeat;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
<script type="text/javascript"> function DoInit()
{
document.body.style.width = 160;
document.body.style.height= 200;
document.body.style.margin=0;
getmyip();
}
var t;
function timerFn()
{
t=setTimeout("timerFn()",1000);
}
function createXMLHttpRequest()
{
if (window.ActiveXObject)
{
return(new ActiveXObject("Microsoft.XMLHTTP"));
}
else if (window.XMLHttpRequest)
{
return(new XMLHttpRequest());
}
}
//function to process an XMLHttpRequest
function process_ajax(phpPage, divID, getOrPost, async)
{
try
{
var xmlHttp = createXMLHttpRequest();
var obj = document.getElementById(divID);
if(getOrPost == "get")
{
xmlHttp.open("GET",phpPage,true);
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
obj.innerHTML = xmlHttp.responseText;
obj.innerHTML=obj.innerHTML+"ss";
}
}
xmlHttp.send(null);
}
}
catch(err)
{
//do nothing
}
}
function process_ajax_sync(phpPage, getOrPost, async)
{
try
{
var xmlHttp = createXMLHttpRequest();
var strRetVal="";
if(getOrPost == "get")
{
xmlHttp.open("GET",phpPage,true);
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
strRetVal = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
}
catch(err)
{
//do nothing
}
return(strRetVal);
}
function getmyip()
{
var queryString = "http://www.inik.pl/data.php";
var strResult = process_ajax_sync(queryString,"get",true);
document.forms["frmIP"].txtIP.value=strResult;
}
function getipdetails()
{
var queryString = "http://www.inik.pl/data.php";
process_ajax(queryString,"ip2l_result","delete",true);
process_ajax(queryString,"ip2l_result","get",true);
}
function roll_over(img_name, img_src)
{
document[img_name].src = img_src;
}
function clear_all()
{
document.forms["frmIP"].txtIP.value="";
document.getElementById("ip2l_result").innerHTML = "";
}
<body onLoad="DoInit();" class="styBody"> <table width="158" border="0" height="193" class="styTable" cellpadding="5" cellspacing="1" > <tr style="border:none; height:10px;"> <td height="30" colspan="7"> <form id="frmIP" style="border:none; margin:0px; margin-top:0px; margin-bottom:0px" > <input name="txtIP" type="text" class="styTextBox" id="id_txtIP" value="" maxlength="15" style="width:126px;"; /><img src='images\\search.png' name="imgsearch" title="Search for Location" alt="Search for Location" width="16" height="16" class="styImage" style="margin-left:2px" onmouseover="roll_over('imgsearch', 'images\\search_hover.png')" onmouseout="roll_over('imgsearch', 'images\\search.png')" onclick="getipdetails()" onkeypress=""> <td height="140" id="ip2l_result" colspan="7" style="vertical-align:top;"></td> <tr><td width="20" height="20"><img src="images\clear.png" name="imgclear" title="Clear All" alt="Clear All" class="styImage" width="16" height="16" onmouseover="roll_over('imgclear', 'images\\clear_hover.png')" onmouseout="roll_over('imgclear', 'images\\clear.png')" onclick="clear_all()"/></td> <td width="20"><img src="images\myip.png" name="imggetip" title="Get My IP Address" alt="Get My IP Address" class="styImage" width="16" height="16" onmouseover="roll_over('imggetip','images\\myip_hover.png')" onmouseout="roll_over('imggetip', 'images\\myip.png')" onclick="getmyip()"/></td> <td width="20"><a href="http://www.workmoment.com/?src=iptolocg"><img src="images\info.png"name="imginfo" title="WorkMoment Home" alt="WorkMoment Home" class="styImage" width="16" height="16" border="0" onmouseover="roll_over('imginfo', 'images\\info_hover.png')" onmouseout="roll_over('imginfo', 'images\\info.png')"/></a></td> <td width="20"> </td> <td width="20"> </td> <td width="20"> </td> <td width="20"> </td>