![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
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? |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Give the <td> tags an ID:
<td id="test"> </td> And use the innerHTML property: function table() {
document.getElementById("test").innerHTML = "Boo!";
} |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
thanks man
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|