I embedded below code into my google sites page. for some reason the alert window is not popping up.
<form xmlns="myform">
<input id="HelloWorld" onClick="alert('Hi')" type="button" value="HelloWorld"/>
</form>
I tried the code in W3school code editor site and its works. Pictures attached.
google actively blocks stuff like popups in JS and maybe some HMTL implementations. I found a post here andk8oms
mentioned his CSS and HTML version works. Check out their write up for a solution [k80ms blog post][2].[2]: https://www.k8oms.net/document/popup
My apologies on the late edit.
Use JS to
getElelementByID
and select a visible/hidden element on myPopup to "show / hide" your window.popupWindow.js
Next you need to style your window with CSS something very basic would be.
style.css
Then we can create an
onclick
to callpopupFunction()
from your HTML page.id="myPopup"
is the important thing here, this is where JS'sgetElementById
attaches itself to.This is a very basic way to create an "alert" style popup window. If you were to define a stylized box with CSS that looks like a modern alert box you can call the
<span class="popuptext" id="myPopup">
anywhere in your HTML to create a popup window. Areas such as a header or upper banner area would be a good place to add thisspan
so it would display in the same spot "top & center" just as an alert box would.