Jump to content
MakeWebGames

small help with onclick?


Nicholas

Recommended Posts

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.

Link to comment
Share on other sites

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=''"

Link to comment
Share on other sites

<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...

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...