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???
comments
Moderator: General Moderators
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
Two ways to do this:
1. use alt messages.
2. make a javascript alert function
1. use alt messages.
2. make a javascript alert function
Code: Select all
<script language="javascript">
function tooltip(itemName){
switch(itemName){
case 'textbox1':var text="This is a tool tip";break;
case 'textbox2':var text="This is a another tip";break;
}
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>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

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
Code: Select all
<html><!-- html is the outmost tag (ignoring instructions) -->
<head>
<script type="text/javascript">
function showHelp(itemName){
switch(itemName){
case 'prenrech':var text="This is a message box";break;
case 'textbox2':var text="This is a message box";break;
}
alert(text);
} <!-- forgot a closing bracket, that's why indents are so usefull ;) -->
</script>
<style type="text/css">
form p { padding-bottom: 40px; }
</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>