Nicholas Posted April 7, 2010 Posted April 7, 2010 hi im wondering can anyone help me on this? i cant figure out what to do... <form method='POST' name='msg' target='shoutbox' action='shoutbox.php?action=post'> Enter Message: <input type='text' name='msg' id='textbox' size='50'> <input type='submit' value='ENTER'> </form> can anyone figure out how to make it so when you click ENTER (button or keyboard) the text in the box will disappear, i cant figure out what "onclick=??????" function i need. can someone help? it be very greatful. Quote
Djkanna Posted April 7, 2010 Posted April 7, 2010 For example you want to use like a message in the text box.. <form action="something.fileext" method="post"> <input type="text" name="message" value="Input your message here" onclick="this.value=''" /> <input type="submit" value="Submit" /> </form> My Javascript isn't so good but it might work onclick="this.value=''" Quote
Nicholas Posted April 7, 2010 Author Posted April 7, 2010 nope :( thanks for trying tho :) i dont think criminal madness likes javascript lol. ive researched on google and used all typed of onclick methods. didnt work... lol. Quote
Djkanna Posted April 7, 2010 Posted April 7, 2010 <html> <head> </head> <body> <form action="#" method="post"> <input type="text" name="name" value="Enter Message" onclick="this.value=''" /> <input type="submit" value="Submit" /> </form> </body> </head> Works fine :), so if you click on the text box to type the 'Value which is set as Enter message;' dissapears... Quote
Nicholas Posted April 7, 2010 Author Posted April 7, 2010 <form action="#" method="post"> with it action='#' wouldnt that stop it from inserting into the shoutbox? if it helps this is what i use to show the shoutbox? <?php include_once 'globals.php'; if($ir['shoutremove'] == 0 && $ir['shoutbox'] == 0) { echo "<table width='95%' class='table' border='0' cellspacing='0'> <tr> <th colspan='3'><h3 style='text-align: left;'>Shout Box <font color=#000000>------------------------</font> [url='shoutlogs.php']? [b]Last 500 Shoutbox Messages[/b] ?[/url]</h3></th> </tr> <tr> <td colspan='3'> <iframe name='shoutbox' marginwidth='0' marginheight='0' border='0' frameborder='0' table align='center' height='185px' width='100%' src='shoutbox.php'> </iframe> </td> </tr> </table>"; } if($ir['banshout'] == 0 && $ir['shoutremove'] == 0 && $ir['shoutbox'] == 0) { echo "<form method=POST name=msg target=shoutbox action=shoutbox.php?action=post> Enter Message: <input type=text name=msg id=textbox size=50 class=inputback> <input type=submit value=ENTER class=inputback> </form> "; } ?> then i put include_once "shout.php"; under include_once "globals.php"; in index.php Quote
Djkanna Posted April 7, 2010 Posted April 7, 2010 Take no notice of my action it was for testing purposes only add onclick='this.value=""' to your message field <input type='text' name='msg' id='textbox' size='50' class='inputback' onclick='this.value=""' /> So for example once someone enters a message and the message stays there so you have to erase what you last wrote to add new message using the code above would erase the text as soon as it's clicked. Quote
DigitalGerm Posted April 8, 2010 Posted April 8, 2010 Nicholas your saying after submit clear the input ? because if you put onclick event trigger in the input text field, this means you don't click the enter button. you may add a function with onsubmit event. were you could tell it to w8 for data submission and after that clear your input easy like "document.shout.msg.value = " "; btw it's kinda odd your form name has the same name as input name. Quote
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.