#130073 - 2004-11-23 05:08 PM
Re: Can i get this to refresh? web page refresh
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Ok, this example updates the HTML on the page.
Forms and named sections are the way to go though. You can do some great tricks.
|
Top
|
|
|
|
#130074 - 2004-11-23 05:23 PM
Re: Can i get this to refresh? web page refresh
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Here is a similar example to the one posted above.
In this version I use DIV to demarcate the area that I want to update. I give the area a name, and then use ".getelementbyid()" to get the area as an object.
You will see that the simple text on the page is unaffected while the rest of it changes. You can use this technique to label discrete areas of the page that you wish to update.
Code:
$oIE=funMakeIE("Countdown timer demo",150,400)
$oIE.document.body.innerHTML="<CENTER>Dynamic area below<DIV ID=divUpdate></DIV></CENTER>"
$oDIV=$oIE.document.getelementbyid("divUpdate")
For $i = 10 To 0 Step -1
Select
Case $i<3 $COLOUR="RED"
Case $i<6 $COLOUR="YELLOW"
Case "Default" $COLOUR="GREEN"
EndSelect
$oDIV.innerHTML="<CENTER><FONT COLOR="+$COLOUR+" SIZE=7>Countdown: "+$i+"</FONT></CENTER>"
Sleep 0.5
Next
$oDIV.innerHTML="<CENTER><FONT COLOR=RED SIZE=7><B>**BOOM**</B></FONT></CENTER>"
Sleep 3
$oIE.Quit
$oIE=0
Exit 0
; -------------------------------------------------------
; Ignore everything below here - this is black-box magic.
; -------------------------------------------------------
Function funMakeIE($sTitle,$iHeight,$iWidth)
$funMakeIE=CreateObject("InternetExplorer.Application")
If $funMakeIE
; Remove clutter
$funMakeIE.toolbar=0 $funMakeIE.menubar=0 $funMakeIE.addressbar=0 $funMakeIE.statusbar=0
; Load dummy
$funMakeIE.navigate("about:blank")
funWait($funMakeIE)
Else
funError("Cannot create IE object")
Exit 1406
EndIf
$funMakeIE.document.write("<HTML>
<HEAD>
<!--
Hand crafted script
Created R. Howarth March 2004
-->
<TITLE>"+$sTitle+"</TITLE>
<SCRIPT Language=JavaScript>
function funDispatcher(s){
frmMain.sStatus.value+=s+';';
}
function funGetScreenSize(){
frmMain.screenheight.value=screen.availHeight;
frmMain.screenwidth.value=screen.availWidth;
}
</SCRIPT>
</HEAD>
<BODY onLoad='funGetScreenSize();' BGCOLOR=LIGHTGREY>
<FORM Name=frmMain>
<INPUT Type=Hidden Name=screenheight Value=''>
<INPUT Type=Hidden Name=screenwidth Value=''>
</FORM>
</BODY>
</HTML>")
$funMakeIE.refresh()
funWait($funMakeIE)
$funMakeIE.height=$iHeight
$funMakeIE.width=$iWidth
$funMakeIE.left=(Cint($funMakeIE.document.frmMain.screenwidth.value)-$iWidth)/2
$funMakeIE.Top=(Cint($funMakeIE.document.frmMain.screenheight.value)-$iHeight)/2
$funMakeIE.visible=1
funWait($funMakeIE)
$=SetFocus($TITLE)
$funMakeIE.visible = 1
Exit 0
EndFunction
Function funWait($oIE)
While $oIE.busy AND $oIE.readystate <> 4 AND @error = 0 Loop
Exit @ERROR
EndFunction
|
Top
|
|
|
|
#130076 - 2004-11-23 05:40 PM
Re: Can i get this to refresh? web page refresh
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
This would be better: Code:
Break on $oIE=funMakeIE("Countdown timer demo",500,500) $oIE.document.body.innerHTML="<CENTER>MY COUNTER HERE: <FONT ID=divAARON></FONT></CENTER>" $oDIV=$oIE.document.getelementbyid("divAARON") $iAARON=0 While @ERROR = 0 $iAARON=$iAARON+1 $oDIV.innerHTML=$iAARON If Not @ERROR Sleep 0.5 EndIf Loop $oIE.Quit $oIE=0 Exit 0
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 248 anonymous users online.
|
|
|