Author Topic: Popup box in HTML  (Read 448 times)

Offline Malcolm Bull

  • RootsChat Veteran
  • *****
  • Posts: 839
    • View Profile
Popup box in HTML
« on: Friday 29 March 19 17:37 GMT (UK) »
Does anyone have the HTML code or a website where I can find such code to allow the website-user to click a link which will display a popup window with a simple piece of text and then (having read the text) allow the user to dismiss the popup window? 

I don't want to have to delve into the black arts of CSS or Javascript.  A simple cut-and-paste piece of HTML code would be ideal.

I have searched for a video and all the ones I have viewed are either incomprehensible or overly  technical.

Any help or suggestions would be appreciated.

Malcolm BUll
Surname interests:

Huntingdon: Bull / Shelford
Rotherham: Andrews / Steel
Easingwold: Snowball / Potter

RootsChat is the busiest, largest free family history forum site in the country. It is completely free to use. Register now.
Also register instantly with Facebook or Twitter (and other social networks). Start your genealogy search now.


Online [Ray]

  • RootsChat Marquessate
  • *******
  • Posts: 5,808
  • UK Census information Crown Copyright
    • View Profile
Re: Popup box in HTML
« Reply #1 on: Friday 29 March 19 19:14 GMT (UK) »


<input type="button" onclick="confirm(' LOTS ! ');" value=" How much do I love thee ? ? ? ? ?">
"The wise man knows how little he knows, the foolish man does not". My Grandfather & Father.

"You canít give kindness away.  It keeps coming back". Mark Twain (?).

RootsChat is the busiest, largest free family history forum site in the country. It is completely free to use. Register now.
Also register instantly with Facebook or Twitter (and other social networks). Start your genealogy search now.


Online GrahamH

  • RootsChat Senior
  • ****
  • Posts: 478
  • www.gjh.me.uk & www.glossopheritage.co.uk
    • View Profile
Re: Popup box in HTML
« Reply #2 on: Friday 29 March 19 19:23 GMT (UK) »
The easiest way is to open a new window using code similar to that shown here:
https://www.quackit.com/html/codes/html_open_link_in_new_window.cfm

Offline hallmark

  • -
  • RootsChat Marquessate
  • ****
  • Posts: 13,757
    • View Profile
Re: Popup box in HTML
« Reply #3 on: Friday 29 March 19 19:30 GMT (UK) »


So you have some words you are using as a Link   e.g  Click here



<p onclick="alert();">Click here<\p>


Put your message in the brackets 

Put whatever you are using for Link where I have put Click here



Give a man a record and you feed him for a day.
Teach a man to research, and you feed him for a lifetime.

Online [Ray]

  • RootsChat Marquessate
  • *******
  • Posts: 5,808
  • UK Census information Crown Copyright
    • View Profile
Re: Popup box in HTML
« Reply #4 on: Friday 29 March 19 19:54 GMT (UK) »


There you go, 3x "solutions" within minutes ( well done "team" ).

Remember, not every answer is a solution.
[ Like things to stop copyright theft. ]

 

"The wise man knows how little he knows, the foolish man does not". My Grandfather & Father.

"You canít give kindness away.  It keeps coming back". Mark Twain (?).

Offline arthurk

  • RootsChat Aristocrat
  • ******
  • Posts: 2,690
    • View Profile
Re: Popup box in HTML
« Reply #5 on: Friday 29 March 19 20:48 GMT (UK) »
I may be wrong, but isn't the onclick attribute used to launch a Javascript routine, which Malcolm said he didn't want to get into?

Graham's answer uses pure HTML, but a whole tab might be overkill if there's only a small amount of text.

Another possibility using just HTML, though it's not exactly what Malcolm asked for, might be to add a title attribute to the link, which pops up a tooltip when hovered.

You can read more about this at https://www.w3schools.com/tags/att_global_title.asp

And if you want to look at onclick: https://www.w3schools.com/tags/ev_onclick.asp

Pages on this site allow you to try out the code and make tweaks to see what happens. I find this very helpful.

EDIT:
I've now had more time to look at this, and I was wrong about onclick requiring Javascript.
Researching among others:
Bartle, Bilton, Campbell, Craven, Emmott, Harcourt, Hirst, Kellet(t), Kennedy,
Meaburn, Mennile/Meynell, Metcalf(e), Palliser, Robinson, Rutter, Shipley, Stow, Wilkinson

Census information is Crown Copyright, from www.nationalarchives.gov.uk

Offline hallmark

  • -
  • RootsChat Marquessate
  • ****
  • Posts: 13,757
    • View Profile
Re: Popup box in HTML
« Reply #6 on: Friday 29 March 19 21:20 GMT (UK) »




No.

<p onclick="alert();">Click here<\p>

is a HTML code  that when someone clicks on   Click here   it displays a Pop up window which displays the text in the Brackets


onmouseover requires  Javascript








Give a man a record and you feed him for a day.
Teach a man to research, and you feed him for a lifetime.

Offline hallmark

  • -
  • RootsChat Marquessate
  • ****
  • Posts: 13,757
    • View Profile
Re: Popup box in HTML
« Reply #7 on: Friday 29 March 19 21:34 GMT (UK) »


The safest and easiest way to check the various solutions would be to just start a new HTML doc with just one line of text 

Then use the Codes


See what you prefer!

Then replicate it on your document.



Give a man a record and you feed him for a day.
Teach a man to research, and you feed him for a lifetime.

Online [Ray]

  • RootsChat Marquessate
  • *******
  • Posts: 5,808
  • UK Census information Crown Copyright
    • View Profile
Re: Popup box in HTML
« Reply #8 on: Friday 29 March 19 21:37 GMT (UK) »



"He" said that he did not want to "delve into the black arts"     
"He" doesn't have to . . . ..


There was not a full reqt spec, just a brief outline.

All 4 answers move him forward     
Why not let "him" review the suggestions?






"The wise man knows how little he knows, the foolish man does not". My Grandfather & Father.

"You canít give kindness away.  It keeps coming back". Mark Twain (?).