mike1313 Posted April 10, 2007 Share Posted April 10, 2007 I have a shoutbox form with <input type=text name=message><input type=submit name=say value=say> then when I hit enter or Say it runs the form in an inline frame just refreshing the frame I want it so if they users hits enter to submit data, that the data gets submitted and as soon as it does it clears the message input so they can starting typing again right away. How can I do this? Quote Link to comment Share on other sites More sharing options...
nogray Posted April 10, 2007 Share Posted April 10, 2007 add an id to the input field <input type=text name=message id=message> in the iframe, add an onload event <iframe onload="document.getElementById('message').value=''; document.getElementById('message').focus();" ..... This should clear the input field and put the focus on it. Quote Link to comment Share on other sites More sharing options...
mike1313 Posted April 12, 2007 Author Share Posted April 12, 2007 thanks that works great but I have another question, ok my input box isnt inside an inline frame, and in one of my inline frames I have a normal text link. I want the user to be able to click on a link inside the iframe and upon doing so it will change the value of the input box thats not in a frame, possible to do this? Quote Link to comment Share on other sites More sharing options...
nogray Posted April 13, 2007 Share Posted April 13, 2007 Just use the "parent" window and it should work if both pages on the same domain <a href="#" onclick="parent.document.getElementById('message').value = 'hello world'; return false;">Click here</a> Change the "hello world" to anything you need, the return false will stop the page from jumping up. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.