- Synter
- Sep 22, 2004
-
-
College Slice
|
I've been working on a Firefox extension, and I'm having trouble with a particular javascript function.
code:function GetStatus(timeout) {
var sreq = new XMLHttpRequest();
sreq.onreadystatechange = function (aEvt) {
if (sreq.readyState == 4) {
if(sreq.status == 200) {
var img = document.write("http://url.com/Smileys/sa/" + sreq.responseText);
document.getElementById("WOPR-ImgLeft").value = img;
document.getElementById("WOPR-ImgRight").src = "http://url.com/Smileys/sa/goonpatriot.png";
}
}
};
sreq.open('GET', URL()+'/toolbar_status.php', true);
sreq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
sreq.send(null);
if (timeout) {
setTimeout ("GetStatus()", 1000*60*30);
}
}
The function is supposed to recursively call itself every 30 minutes (it does), retrive the image name from toolbar_status.php (it does) and point two images that appear in the toolbar to it.
I have tried multiple combinations of document.getElementById(image id).value and .src with combinations of the above image options (document.write("http://url.com/Smileys/sa/" + sreq.responseText) and a direct url like "http://url.com/Smileys/sa/goonpatriot.png") and neither seem to work.
The part of overlay.xul in particular is correct as far as I can tell, but posting it just in case:
code:<toolbaritem flex="0" height="20">
<image id="WOPR-ImgLeft" />
</toolbaritem>
<toolbaritem flex="0" align="center">
<label id="WOPR-GetMessage" />
</toolbaritem>
<toolbaritem flex="0" height="20">
<image id="WOPR-ImgRight" />
</toolbaritem>
Edit:
Never mind, fixed.
Going to write "I shouldn't be using document.write to concatenate strings" 100 times on the blackboard
Synter fucked around with this message at 12:49 on Jun 27, 2009
|
#
¿
Jun 27, 2009 11:53
|
|
- Adbot
-
ADBOT LOVES YOU
|
|
#
¿
May 6, 2024 03:21
|
|