Page 1 of 1

comments

Posted: Wed Apr 02, 2003 6:17 am
by micknic
Hi guys

I'm doing a intranet. I would like that when user clic on a textbox a dialbox or message box appear to give instructions to the user. A bit like comments in Word

Could someone give me advices???

Posted: Wed Apr 02, 2003 8:52 am
by daven
Two ways to do this:

1. use alt messages.
2. make a javascript alert function

Code: Select all

<script language="javascript">
function tooltip(itemName)&#123;
switch(itemName)&#123;
  case 'textbox1':var text="This is a tool tip";break;
  case 'textbox2':var text="This is a another tip";break;
&#125;
alert(text);
</script>
<HTML>
<input type=text name="textbox1" onclick="tooltip(this.name)">
<input type=text name="textbox2" onclick="tooltip(this.name)">
<input type=text name="textbox1" alt="Hello">
</HTML>

Posted: Wed Apr 02, 2003 9:17 am
by micknic
Hi daven

I tried your solution. This is my code:

<script language="javascript">
function tooltip(itemName){
switch(itemName){
case 'prenrech':var text="This is a tool tip";break;
case 'textbox2':var text="This is a another tip";break;
}
alert(text);
</script>
<html>
<body>
<form action="findfin.php" method="post">
<H3>Cette page vous permet de trouver l'adresse e-mail d'un membre de la communauté</H3>
<p>
<p>
<p>
<p>
<p>
Introduisez le prénom de la personne recherchée:<input type="text" name="prenrech" size="30" maxlength="30" onclick="tooltip(prenrech)">
<p>
<p>
<p>
<p>
<p>
<p>
<p>
Introduisez maintenant son nom:<input type="text" name="nomrech" size="20" maxlength="20">
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<input type="submit" value="Effectuer la recherche">
</form>
</body>
</html>

When I click on the first textbox i got message: this page contains errors....

What's the problem???
Hope you can help me

:P :lol:

Posted: Wed Apr 02, 2003 9:38 am
by volka

Code: Select all

<html><!-- html is the outmost tag (ignoring instructions) -->
	<head>
		<script type="text/javascript">
			function showHelp(itemName)&#123;
				switch(itemName)&#123;
					case 'prenrech':var text="This is a message box";break;
					case 'textbox2':var text="This is a message box";break;
				&#125;
				alert(text);
			&#125; <!-- forgot a closing bracket, that's why indents are so usefull ;) -->
		</script>
		<style type="text/css">
			form p &#123; padding-bottom: 40px; &#125;
		</style>
	</head>
	<body>
		<form action="findfin.php" method="post">
			<H3>Cette page vous permet de trouver l'adresse e-mail d'un membre de la communauté</H3>
			<p>
				Introduisez le prénom de la personne recherchée:
				<input type="text" name="prenrech" size="30" maxlength="30" />
				<input type="button" value="aide" onClick="showHelp('prenrech');" />
			</p>
			<p>
				Introduisez maintenant son nom:<input type="text" name="nomrech" size="20" maxlength="20">
			</p>
			<p>
				<input type="submit" value="Effectuer la recherche">
			</p>
		</form>
	</body>
</html>
hope that helps ;)

Posted: Wed Apr 02, 2003 10:01 am
by micknic
it works

Thank you very much