Click to See Complete Forum and Search --> : using innerHTML instead of form input


AH.C
02-21-2003, 06:13 PM
I downloaded a script that retrieves the latest update and returns the query to a new window.

Original relevant script:
....
<A
href="javascript:update()">See latest update.</A>
...
function update()
{
myWindow = window.open("","myWindow","width=400,height=250");
myWindow.document.write('<html><body bgcolor="gray">');
myWindow.document.write('<h2 style="font:bold 16px Arial,sans-serif; vertical-align:middle;">Please wait for updated data...</h3><form action="http://foo.com/cgi/get_update.pl" name="update_form">')
myWindow.document.write('<input type="hidden" value="1" name="get_update"></form></body></html>');
myWindow.document.update_form.submit();
}
...

I haven't spent much time with forms, so I'm stumped after trying to rewrite the script the script to write to an inline tag within the document. All I'm getting is an "object doesn't support this method or property message".

Attempted rewrite:
...
<span id="curUpdate">&nbsp;</span>
...
function update()
{
curUpdate.innerHTML.write('Please wait for updated data<form action="http://foo.com/cgi/get_update.pl" name="update_form">');
curUpdate.innerHTML.write('<input type="hidden" value="1" name="get_update"></form>');
curUpdate.innerHTML.update_form.submit();
}
document.onload=update
...

What am I doing wrong?:confused:

TIA

AH.C
02-21-2003, 09:12 PM
Dave.
Dooh!
Thanks for the headsup. I meant for it to be it to appear in the parent document and not in the new window. It works, but...

Now I realize there's a new problem. Changing the source file is not an option, since I don't want to bother our IT dude every now and then to alter or add files on the corporate server just for my convenience--what the powers-that-be dish out is pretty much what we have to accept.

What I need to do with the spanned element is to extract the data for reuse on my dashboard, from the html file that's served up, for example.

Served up HTML:
<html><head><title>Open Action Items</title>
</head>
<body bgcolor="#FFCC11">
<table height="100%" width="100%" border="0">
<tr><td align="center" valign="center">
<font face="Arial, sans-serif" size="+1"><b>23 open action items.</b></font>
</td></tr></table></body></html>

I seem to recall a script or two somewhere that might possibly do the trick.

1) If it is not possible to simply use javascript to extract the data without displaying the new window, then,

2) I need something that will let the popup remain hidden or 0px width long enough to find the innerHTML of <b> </b>, extract that string then close the popup immediately thereafter.

Getting this script right would make it easy to customize my own pages whenever I need certain info immediately and always at hand without and without having to jump around to collect it all.

Any suggestions?

Thanks

AH.C
02-21-2003, 11:51 PM
Dave,

thanks, but no dice--the gray matter is getting duller by the minute. I'm thru fooling with it for now. Perhaps I'll figure it out after I give it a break for a while. Have a good weekend.