المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Add a drop-down information box to your web page



bahattab
04-03-2008, 11:42 AM
Add a drop-down information box to your web page


1) Determine messages needed. Add as many messages as you need. Remember that javascript begins counting with zero. Follow the pattern below to add additional messages. When finished, add this script between the <head> tags.

2) Add this to the area of the page that you want the drop-down box to appear. Each time you add additional messages above, don't forget to add the corresponding <option> below.






<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>New Page 1</title>
</head>

<body>

Add a drop-down information box to your web page Program Example: 1) Determine
messages needed. Add as many messages as you need. Remember that javascript
begins counting with zero. Follow the pattern below to add additional messages.
When finished, add this script between the tags.

<head>

<script language="javascript">
<!--
function comment(form){
if(form.comm.selectedIndex==0){
var message="Select a topic.";
}

if(form.comm.selectedIndex==1){
var message="Your message here (1nd message).";
}

if(form.comm.selectedIndex==2){
var message="Your message here (2nd message).";
}

if(form.comm.selectedIndex==3){
var message="Your message here (3rd message).";
}

form.comments.value=message;

}
//-->

</script>
2) Add this to the area of the page that you want the drop-down box to appear.
Each time you add additional messages above, don't forget to add the
corresponding
<option>below.
<form>

<select name="comm" onchange="comment(this.form)">
<option selected>--------------------</option>
<option>General information</option>
<option>Mechanism of action</option>
<option>Warfarin resistance</option>
</select> <br>
<textarea name="comments" rows="5" cols="70" wrap="virtual">

</textarea></form>
</head>

</body>

</html>




http://www.globalrph.com/davescripts/textinfo.htm

http://www.globalrph.com/davescripts/