Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Calling a function in a table (http://www.programmingforums.org/showthread.php?t=2698)

Navid Mar 10th, 2005 11:29 AM

Calling a function in a table
 
<HTML>

<HEAD>

<SCRIPT LANGUAGE="JAVASCRIPT">

function table()

{
document.write("example")
}

</SCRIPT>

</HEAD>

<BODY>

<TABLE BORDER=3>
<TR><TD>
"HERE"
</TD></TR>
</TABLE>

<FORM>
<INPUT TYPE="BUTTON" VALUE="FUNCTION IN TABLE" onClick="table()">

</BODY>

</HTML>


How would i call the function to work in the table instead of starting a new page? Like when i click on the button, i want it to write "example" in the table.

Can anyone help me?

Ooble Mar 10th, 2005 5:46 PM

Give the <td> tags an ID:
<td id="test">
</td>

And use the innerHTML property:
:

function table() {
    document.getElementById("test").innerHTML = "Boo!";
}


Navid Mar 11th, 2005 11:09 AM

thanks man :)


All times are GMT -5. The time now is 4:22 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC