Javascript code for pop ups

J

johnny15

I have copied from a site a javascript code for my web site to create a
pop up. This works fine on older versions of browser but not the most
recent. Whilst I have been searching for some new code to replace the
old code I have also learnt that the javascript will not always work
as it may not be enabled.

Therefore does anyone have some code that I could copy that will work
fine on all browser and if the javascript is not enabled.

Thanks in advance
 
O

[on]

I have copied from a site a javascript code for my web site to create a
pop up. This works fine on older versions of browser but not the most
recent. Whilst I have been searching for some new code to replace the
old code I have also learnt that the javascript will not always work
as it may not be enabled.

Therefore does anyone have some code that I could copy that will work
fine on all browser and if the javascript is not enabled.

Thanks in advance

Depends on how you want it to work.

If you want to open a link in a new window, you can use <a href="URL"
target="_blank">DESCRIPTION</a>

I can't really see anyother solution or "use cases" that would work
without JavaScripts.

// Switchable
 
A

ASM

johnny15 a écrit :
I have copied from a site a javascript code for my web site to create a
pop up. This works fine on older versions of browser but not the most
recent. Whilst I have been searching for some new code to replace the
old code I have also learnt that the javascript will not always work
as it may not be enabled.

Therefore does anyone have some code that I could copy that will work
fine on all browser and if the javascript is not enabled.

what works fine without JS :

<a href="myPage.htm" target="_blank">my page</a>

Nothing else than that can work without JS.

And, even with this code of gran' Ma, some browsers can not open a new
window.
 
M

Markus Ernst

johnny15 said:
I have copied from a site a javascript code for my web site to create a
pop up. This works fine on older versions of browser but not the most
recent. Whilst I have been searching for some new code to replace the
old code I have also learnt that the javascript will not always work
as it may not be enabled.

Therefore does anyone have some code that I could copy that will work
fine on all browser and if the javascript is not enabled.

<a href="page/in/popup.html" onClick="window.open('page/in/popup.html',
'popupWindowName'); return false">Click here to open popup</a>

If javascript is available, the function in the onClick handler is
called, "return false" cancles the calling of the page specified in the
href attribute. Without javascript, the page in the href attribute is
called normally.
 
T

The Magpie

johnny15 said:
I have copied from a site a javascript code for my web site to create a
pop up. This works fine on older versions of browser but not the most
recent. Whilst I have been searching for some new code to replace the
old code I have also learnt that the javascript will not always work
as it may not be enabled.

Therefore does anyone have some code that I could copy that will work
fine on all browser and if the javascript is not enabled.
If the browser does not enable Javascript, then *no* Javascript will
work on it at all. That is the point. What is more, if the browser also
does not enable popups then *even if* Javascript is enabled your code
still won't work.

You are expecting users to conform with what you want to do. The idea of
good code is that *you* make it work with what *they* want to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top