Forum Replies Created

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thanks,
    but putting this in the above code which is in an HTML Content field, would stop my page loading, and messing up with my browser needed to quit the Safari tab.

    This is the code
    https://code.sololearn.com/WGJm3UQu9rV5/#html

    My website where the final code will be inserted is here: http://www.jeanlou.net/grid-layout-calculator/golden-canon/

    • This reply was modified 8 years, 2 months ago by tilou.
    • This reply was modified 8 years, 2 months ago by tilou.

    Thanks for your prompt reply, below is my code
    I want to replace the variables by fieldnames. My second question is: can the canvas width be replace by fieldname as well?

    <canvas id="canvas" width="500px" height="500px" style="background: #fff; padding:20px;"></canvas>
    <script>
     //Page size
          var bw = 207;
          var bh = 315;
    
          //page padding
          var pw = 0 + 0.5;
          var ph = 0;
    
          //Grid every
          var v = bw/9;
          var h = bh/9;
    
          //margins
          var tm = h;
          var bm = h*2;
          var om = v*2;
          var im = v;
          
          // Percenatge % 
    
          var canvas = document.getElementById("canvas");
          var context = canvas.getContext("2d");
    
          function drawBoard() {
              
            // text area -- Blue box 
            var mw = bw - (im + om);
            var mh = bh - (tm + bm);
    
            context.beginPath();
            context.rect(om + 0.5, tm + 0.5, mw, mh);
            //duplicate --- Inverted
            context.rect(im + 0.5 + bw, tm + 0.5, mw, mh);
            context.fillStyle = "ffddff";
            context.fill();
            context.strokeStyle = "#e0d2e0";
            context.stroke();
    
            //horizontal lines
            for (var x = 0; x <= bw; x += v) {
              context.beginPath();
              context.moveTo(x + pw, ph);
              context.lineTo(x + pw, bh);
              context.strokeStyle = "#e0d2e0";
              context.stroke();
            }
            //vertical lines
            for (var x = 0; x <= bh; x += h) {
              context.moveTo(pw, x + ph + 0.5);
              context.lineTo(bw, x + ph + 0.5);
              context.strokeStyle = "#e0d2e0";
              context.stroke();
            }
            // Diagonals
            context.beginPath();
            context.strokeStyle = "8aa3d8";
            //
            context.moveTo(pw, bh);
            context.lineTo(bw, ph);
            context.moveTo(pw + bw, ph);
            context.lineTo(bw + bw, bh);
            //
            context.moveTo(pw, bh);
            context.lineTo(bw*2, ph);
            context.moveTo(pw, ph);
            context.lineTo(bw + bw, bh);
            context.stroke();
            
            //Horizontal Green
            context.beginPath();
            context.strokeStyle = "8aa3d8";
            //
            context.moveTo((bw/9)*6 + 0.5, ph);
            context.lineTo((bw/9)*6 + 0.5, (bh/9)*3);
            //
            context.moveTo((bw/9)*6 + (bw/9)*6 + 0.5 , ph);
            context.lineTo((bw/9)*6 + (bw/9)*6 + 0.5, (bh/9)*3) + ((bw/9)*6);
            //
            context.moveTo((bw/9)*6, ph);
            context.lineTo((bw/9)*6 + (bw/9)*6, (bh/9)*3) + (bw/9)*6;
            //
            context.moveTo((bw/9)*6 + (bw/9)*6, ph);
            context.lineTo((bw/9)*6, (bh/9)*3);
            context.stroke();
            
            // Paper -- Red box 
            context.beginPath();
            context.strokeStyle = "red";
            context.rect(pw, ph, bw, bh + 0.5);
            //duplicate
            context.rect(pw + bw, ph, bw, bh + 0.5);
            context.stroke();
          }
          drawBoard();
    
    </script>

    How do you call a fieldname in an HTML Content field (HTML & Javascript)?

    • This reply was modified 8 years, 2 months ago by tilou.
    Thread Starter tilou

    (@tilou)

    Got it!

    Important remove the default style

    #fbuilder .my-field select{
     border: 0 !important;.  /*Removes border*/
         -webkit-appearance: none;  /*Removes default chrome and safari style*/
         -moz-appearance: none;  /*Removes default style Firefox*/
    }
    • This reply was modified 8 years, 3 months ago by tilou.
    Thread Starter tilou

    (@tilou)

    It’s not enough, my form setting uses the default template.
    and cannot change the border radius of the dropdown for example
    and color of arrows etc.

    Thread Starter tilou

    (@tilou)

    Great thanks!

    Thread Starter tilou

    (@tilou)

    Great thanks! It works!
    Hope am not abusing your time can you please help me with this one?
    function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;}

    • This reply was modified 8 years, 3 months ago by tilou.
Viewing 7 replies - 16 through 22 (of 22 total)