1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development Google Sites & Jscript help

Discussion in 'Software' started by Burnout21, 20 Jun 2016.

  1. Burnout21

    Burnout21 Mmmm biscuits

    Joined:
    9 Sep 2005
    Posts:
    8,616
    Likes Received:
    197
    Hi,

    So I'm trying to embed a simple little bit of code to a "google sites" site for work, and I have been out of my depth since the beginning. (It's a personal work project to try and help others eventually.)

    Anyway I have been pulling my hair out over this all weekend.

    Code:
    
    
    <!DOCTYPE html>
    <html>
      <head>
        <base target="_top">
      </head>
      <body>
    <input type="text" id="Honeycomb" >
    <input type="text" id="Skin" >
    
     <p>Click the "Calculate" button to get the Honeycomb Thickness.</p>
    
    <button onclick="myFunction()">Calculate</button>
    
     <p id="HC"></p>
    
     <script type="text/javascript">
    function myFunction() {
        var a = document.getElementById("Honeycomb").value;
     var b = document.getElementById("Skin").value;
        document.getElementById("HC").innerHTML = a-b;
    }
    </script>
     
     </body>
    </html>

    It works perfectly fine over on w3, but when loaded into the "sites" site, it fails to function.

    Then I read how google has prevented <scripts> from starting, so I went the route of a HTML box hoping that would change. Nope.

    Then I tried the Google Scripts, and link, but still nope.

    Where am I going wrong?

    I have grand plans if only I could overcome this small irritable stumbling block.
     
    Last edited: 20 Jun 2016
  2. Highland3r

    Highland3r Minimodder

    Joined:
    25 Jul 2003
    Posts:
    7,559
    Likes Received:
    16
    You could do it via apps script (basically same as javascript) and embed that in your site - basically just publish your webpage as a service and embed it.
    have some demos i can share the sites link for, but it's semi work specific so would rather not publish on the wider interwebs (and some other cool email based demos)

    It's relatively straightforward to do (google apps script is fricking awesome too) and may get you what you want...

    Otherwise a friend recommended AWS for basic hosting - you have to configure the server yourself bu he pays next to nothing per month for the light use his site gets + you could do whatever you wanted.

    <edit>
    Ok, had a shot at this - pretty much just copy/paste your code and add some basic gs to point it to the html file - if you have a google account i'll send over the project.

    This link should work for anyone and can be embedded in a sites page easily enough or run standalone

    https://script.google.com/macros/s/AKfycbweq4pKYSnpkvPiE6Y0mXYa7m74B75uJWajoAQxJR_fb1Uz-il_/exec

    </edit>
     
    Last edited: 20 Jun 2016
  3. Burnout21

    Burnout21 Mmmm biscuits

    Joined:
    9 Sep 2005
    Posts:
    8,616
    Likes Received:
    197
    I tried the app's script, but it fails to load it. Could it be because I have html inside the script?

    Webdev or any dev to that matter is very much my weakest area.
     
  4. Highland3r

    Highland3r Minimodder

    Joined:
    25 Jul 2003
    Posts:
    7,559
    Likes Received:
    16
    See edit above. If you have a gmail account, shoot me a PM and I'll share some code with you. Can talk you though a though things as well if needed - I'm no web dev either but apps script is pretty awesomesauce!
     
    Burnout21 likes this.
  5. Burnout21

    Burnout21 Mmmm biscuits

    Joined:
    9 Sep 2005
    Posts:
    8,616
    Likes Received:
    197
    PM'd
     

Share This Page