Math Editor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mini13
    New Member
    • Mar 2013
    • 13

    Math Editor

    Hi
    I need help in creating a math editor to my form. Please tell me how to create a math editor which includes all symbols like sigma,pi etc. By clicking a button i want to get open the math editor. And after selecting the symbol from math editorit should seen like <font symbol=√>√</font> Please tell me how to do that.√=&#8730Th e value alone will seen inbetween font tags &#8730
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    for a start have a look here: http://mathdox.org/formulaeditor/

    Comment

    • mini13
      New Member
      • Mar 2013
      • 13

      #3
      But is that not possible to create by our own.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        sure - just have a look at the code there to see how they solved the issue - to get an idea of it

        Comment

        • mini13
          New Member
          • Mar 2013
          • 13

          #5
          Ok gits. I will see the code to get some idea.If any doubts i will ask you again.

          Comment

          • mini13
            New Member
            • Mar 2013
            • 13

            #6
            Sorry i cann't understand the code http://mathdox.org/formulaeditor/

            Comment

            • mini13
              New Member
              • Mar 2013
              • 13

              #7
              Please help me with some samples. Please

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Difficult for people to help if they don't know what you don't understand from the given code. Is it too complex for you? Are there constructs in it that you don't understand? If it looks like the code is too advanced then go back to basic tutorials like the W3Schools tutorials here :http://www.w3schools.com/js/default.asp
                Otherwise you need to say what you don't understand or people won't know how to help.

                Comment

                • mini13
                  New Member
                  • Mar 2013
                  • 13

                  #9
                  I have some sample code for the math editor.

                  Code:
                  <html>
                  <head>
                      <style>
                          .popup {
                              position: absolute;
                              left: 100px;
                              top: 100px;
                              border: 1px solid #000;
                              background-color: #f0f0f0;
                          }
                  
                          .popup .symbol {
                              display: inline-block;
                              padding: 5px;
                              margin: 10px;
                              border: 1px solid #000;
                          }
                      </style>
                      <script>
                          var symbolPopup = null;
                          function CreateSymbolPopup () {
                              if (symbolPopup) {
                                  return;
                              }
                  
                              symbolPopup = document.createElement ('div');
                              symbolPopup.className = "popup";
                  
                              var symbols = [8719, 8721, 8730];
                              for (var i = 0; i < symbols.length; i++) {
                                  var symbolButton = document.createElement ('span');
                                  symbolButton.innerHTML = '&#' + symbols[i] + ';';
                  //alert(symbolButton.innerHTML);
                                  symbolButton.onclick = AddSymbol;
                                  symbolButton.className = "symbol";
                                  symbolPopup.appendChild (symbolButton);
                              }
                              document.body.appendChild (symbolPopup);
                          }
                  
                          function ShowSymbols () {
                              CreateSymbolPopup ();
                              symbolPopup.style.display = "";
                          }
                          function HideSymbols () {
                              if (symbolPopup) {
                                  symbolPopup.style.display = "none";
                              }
                          }
                  
                          function AddSymbol () {
                              var editor = document.getElementById ('editor');
                              editor.value += this.innerHTML;alert(editor.value)
                              HideSymbols ();
                          }
                      </script>
                  </head>
                  <body>
                      <button onclick="ShowSymbols ()">Symbols</button>
                      <textarea id="editor"></textarea>
                  </body>
                  </html>
                  But when clicking the symbol button I want to view the symbol into my form.Notoutside my form. Also i wnat to do by clicking the symbols, The symbols not get entered directly to my textarea. Its corresponding value is to get entered. eg &#62

                  Comment

                  • r035198x
                    MVP
                    • Sep 2006
                    • 13225

                    #10
                    Which form? I don't see a form in your posted code.

                    Comment

                    • mini13
                      New Member
                      • Mar 2013
                      • 13

                      #11
                      I haven't posted my form. Its only a sample for the math symbols.

                      Comment

                      Working...