homepage Welcome to WebmasterWorld Guest from 54.242.126.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Alter Function: Target Textbox instead of Alert
Modify javascript function to target textbox
Rougy

10+ Year Member



 
Msg#: 434 posted 4:52 pm on Jun 6, 2003 (gmt 0)

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);

 

korkus2000

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



 
Msg#: 434 posted 7:50 pm on Jun 6, 2003 (gmt 0)

Like this?

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

Rougy

10+ Year Member



 
Msg#: 434 posted 8:01 pm on Jun 6, 2003 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved