Thread: drop down menu

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0

    drop down menu


    Hi,
    Please help me for making a dropdown menu for font size,font name and to make a color palatte in javascript.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0
    Sorry i cann't understand yukti023
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0
    Originally Posted by yukti023
    what is SEO and give the topic of on page
    No idea about the SEO.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0
    Code:
    function changeSize(size){
    for ( var t = 0; t <= x.length; ++t ){
        // change div text font size.
      // document.getElementById("text").style.fontSize = size;
    document.getElementById(x[t]).style.fontSize = size + "px";
    }
    }
    function updateh1family() {
                var selector = document.getElementById('selectFontFamily');
                var family = selector.options[selector.selectedIndex].value;
                var a1 = document.getElementById('a1')
                a1.style.fontFamily = family;          
              }
    </script>
    </head>
    <body>
    Select size:
    <select name="sizeselect" onchange="changeSize(this.value)">
    <option value="10">10</option>
    <option value="13">13</option>
    <option value="15">15</option>
    <option value="17">17</option>
    <option value="19">19</option>
    <option value="21">21</option>
    <option value="23">23</option>
    <option value="50">50</option>
    </select>
    <select id="selectFontFamily" name="selectFontFamily" onchange="updateh1family();">
        <option> Serif </option>
        <option> Arial </option>
        <option> Sans-Serif </option>                                                                
        <option> Tahoma </option>
        <option> Verdana </option>
        <option> Lucida Sans Unicode </option>                                                        
      </select>
    <!--<div id="text">
      This is a font size changer using javascript .
    </div>-->
    <textarea name="a1" id="a1" style="width: 200px; height: 100px;"></textarea>
    <textarea name="ques1" id="ques1" style="width: 200px; height: 100px;"></textarea>
    The above is my code. Its working fine.
    Still having another problem.If i want to increase the size for anyone text area means how to do for that.Because now for all the textarea input the size is increasing.
    Also please tell me how to work with the above code for font name and also i want to know how to do the color palatte.For example in our word document button A will be there.By clicking the A the colour palatte is viewed and from that we can select the colour what we want.Please tell me how to do this. Else is there any other way for doing this. Please tell me.

    Also please tell me is it possible to do like,for example i'm entering a text as "welcome to w3schoolsforum". In this i just want to highlight the word w3schoolsforum alone.Is it possible to do.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0
    Code:
    <script type="text/javascript">
    function formatText(el,tag){
    var selectedText = document.selection?document.selection.createRange().text:el.value.substring(el.selectionStart,el.selectionEnd);
    if(selectedText!=''){
    var newText='<'+tag+'>'+selectedText+'</'+tag+'>';
    el.value=el.value.replace(selectedText,newText)
    }
    } 
    </script>
    </head>
    <body>
    <form action="" id="myForm">
    <textarea name="myTextarea" rows="12" cols="50">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea><br>
    <textarea name="mytextarea2" rows="10" cols="50">His is my second textarea and I want the below buttons work for it as well.</textarea><br>
    <input type="button" value="Bold" onclick="formatText(myTextarea,'b')">
    <input type="button" value="Italic" onclick="formatText(myTextarea,'i')">
    <input type="button" value="Underline" onclick="formatText(myTextarea,'u')">
    The above code is to put the selected text inbetween the tags.Like this i want to do for font size. Is it possible to do.If so please tell me how to do.

IMN logo majestic logo threadwatch logo seochat tools logo