469,645 Members | 1,393 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Title name of the window should be the same as selected option

Hi,
Please see the below html code.i am able to get whatever selected in the drop down list box.
But i need to see the title name of the window [<title>]as it is selected could you please suggest in this regard.
Follwing is my code:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  5. <title>selected Item</title>
  6. <script language="javascript">
  7. function selecteditem(optionvalue){
  8. alert(optionvalue.options[optionvalue.selectedIndex].value);
  9. }
  10. </script>
  11. </head>
  12. <body>
  13. <form name="selform" onSubmit="selecteditem(devicelist)">
  14. <select name="devicelist">
  15. <option value="Device1">Device1</option>
  16. <option value="Device2">Device2</option>
  17. <option value="Device3">Device3</option>
  18. </select>
  19.  
  20. <input type="submit" name="submit" value="click"/>
  21. </form>
  22. </body>
  23. </html>
  24.  
regards,
rama krishna
Oct 13 '10 #1
2 1012
JKing
1,206 Expert 1GB
Hi, here is a quick example that should help you.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.     <title>Watch Me Change</title>
  4.     <script type="text/javascript">
  5.         function setTitle()
  6.         {
  7.             var x = document.getElementById("devicelist");
  8.             document.title = x.options[x.selectedIndex].value;
  9.         }
  10.     </script>
  11. </head>
  12. <body>
  13.     <select name="devicelist" id="devicelist" onchange="setTitle();">
  14.         <option value="Device1">Device1</option>
  15.         <option value="Device2">Device2</option>
  16.         <option value="Device3">Device3</option>
  17.     </select>
  18. </body>
  19. </html>
  20.  
Oct 13 '10 #2
Hi Jking,

Thanks for your suggestion.
Now i am able to see the selected item in my title.

regards,
Rama Krishna
Oct 14 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Mark Kolber | last post: by
6 posts views Thread by Chameleon | last post: by
2 posts views Thread by dhaneshrs | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.