Welcome to WebmasterWorld Guest from 54.163.84.199

Forum Moderators: open

Alter Function: Target Textbox instead of Alert

Modify javascript function to target textbox

   
4:52 pm on Jun 6, 2003 (gmt 0)

10+ Year Member



Hi all,

I need to modify this function to send the date value to a textbox within the page instead of to an alert box:

function message(cell)
{
alert(cellday[cell]);
}

The HTML form is directly under the calendar object on the same page:

<!-- CALENDAR CODE -->
<SCRIPT LANGUAGE="JavaScript">calendar();</SCRIPT>

<!-- TEXT BOX -->
<form method="post" action="report.html">
<input type="text" name="StartDate" id="StartDate" value="01/01/2003" size="8" maxlength=10>
</form>

I'm looking for something similar to this, except it targets a textbox within the page:

window.opener.document.getElementById['StartDate'].value = cellday(cell);

7:50 pm on Jun 6, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Like this?

function message(cell)
{
document.getElementById['StartDate'].value = cellday[cell];
}

8:01 pm on Jun 6, 2003 (gmt 0)

10+ Year Member



Yes, almost like that. I found it on another site. The first set of brackets should be parenthesis, but you are basically right:

document.getElementById('StartDateID').value=cellday[cell];

Thanks for taking the time.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month