Google Sites JavaScript (Inline JavaScript)

Google Sites JavaScript (Inline JavaScript)

Inline JavaScript is only available in between  Form Elements directly in Google Sites. 

The Form elements will automatically be rendered as a Google Gadget.

JavaScript 'Alert' Box

The Alert Box can be used to notify or display information. the alert box Pops up to Display the message you want.

Anchor & 'Alert' Box

<form xmlns="">
<a href="#" id="HelloWorld" onClick="alert('Hello Google Sites World')">onClick</a>

Inline Javascript : Alert Box

Button 'Alert' Box
<form xmlns="">
<input id="HelloWorld" onClick="alert('Hello Google Sites World')" type="button"  value="HelloWorld"/>

Selection Box 'Alert' Box
<form xmlns="">
<select height="50px" 

    <option value="">Choose a Link</option>
    <option value="">Google Maps</option>
    <option value="">Google Search</option>
    <option value="">Google Image Search</option>
    <option value="">Google Calendar</option>
    <option value="">Google Translate</option>

Confirmation Box

The confirmation Dialog Box Pops up from a webpage to display 2 options "OK" to continue or "Cancel".

<a href="" onclick="return (confirm('Follow this link?'))">Goopal - Google Sites Examples</a>

Popup Window

Full Inline JavaScript 'Popup Window' Function

You can drag the following bookmarklets into your browser Firefox/Chrome , so you can run the javascript code from your browser on any webpage.

<a class="marker" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,''+c(b.location) + '\x26hl=en','coop_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=420px,width=700px,resizable=1,alwaysRaised=1,scrollbars=1');a.setTimeout(function(){d.focus()},300)})();" title="Drag this 'Google Marker' Link into the Browsers Address Bar"> Google Marker</a>


It is possible to attach a jQuery .Click() Javascript Event using the HTML Box . This improves loading times and methods / events / listeneners latency within a webpage.