James Kimble <> writes:
> I've got a javascript source file with functions (creates a bar graph)
> I want to call from inside an html table cell so that the graph
> appears in the cell.
....
> <head>
> <script language="JavaScript" src="bargraph.js"></script>
Replace language="JavaScript" with type="text/javascript" to get
valid HTML (the type attribute is required, the language attribute
is irrelevant and deprecated).
> <script language="JavaScript">
> function createBarGraph() {
> graph = new BarGraph("HorizBar");
> graph.values = "1000";
> document.write(graph.create());
> }
> </script>
> </head>
> <body onLoad="createBarGraph()">
As others have said, this does document.write when the page has finished
loaded, and the document has been closed. Which means that it replaces
the curren document instead of appending to it.
So don't call it here.
> <table width="100%" border="0">
> <tr>
> <td>HPX40</td>
> <td>CUSTOMER DEFINED TEXT </td>
> <td> </td>
> </tr>
> <tr>
> <td>Plate Status:</td>
> <td><form name="f1" action="javascript:createBarGraph()"
> method="post"></td>
If you just want to put the bar graph here when the page is loading,
you should just call your function:
<td><script type="text/javascript">
createBarGraph();
</script>
That will call document.write to insert HTML into the page just after
the script element.
/L
--
Lasse Reichstein Nielsen -
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'