Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling javascript functions

Status
Not open for further replies.

ducky62

Programmer
Jul 10, 2001
24
CA
is there a way to call a javascript function without an event

normally you put the calls in an onClick or onChange event, but I want

<TR>
<TD>
ToCurrency(1234);
</TD>
</TR>
but it just displays &quot;ToCurrency(1234)&quot;

any ideas

Thanks
 
I believe what you are attempting to do is write out the content of your function inside the table. For this you have to use the <script></script> tags as well as document.write() as follows :

<TR>
<TD>
<scrip>
document.write(ToCurrency(1234));
</script>
</TD>
</TR>

Is this what you need? Gary Haran
 
Actually it should be

<script language=&quot;javascript&quot;>
ToCurrency(1234)
</script>

This will call the function ToCurrecy (it should be located above the code that calls the funciton
 
put aside the typo I had (scrip instead of script) the code I gave you should work great.

<script></script> takes by default the latest javascript/ecmascript engine the browser has.

Here is the typoless version :

<TR>
<TD>
<script>
document.write(ToCurrency(1234));
</script>
</TD>
</TR>

Gary Haran
 
thanks,

it worked great

i was just forgetting the script tags
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top