Forum Moderators: open
<script>
function pause(milliseconds) {
// freezes window/execution for milliseconds given
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
// wait 3 seconds
pause(3000);
// hide lightbox
closeLightbox();
// continue
return true;
}
function closeLightbox() {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
}
</script>
<a href="test.html" target="_blank" onclick="if(openLightbox()) { return true; }">
click here
</a>
<script>
function pause(milliseconds) {
// freezes window/execution for milliseconds given
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
}
function closeLightbox() {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
}
</script>
<a href="test.html" target="_blank" onclick="openLightbox(); pause(3000); closeLightbox(); return true;">
click here
</a>
<script>
function pause(milliseconds) {
// freezes window/execution for milliseconds given
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
function delay(milliseconds) {
// delays pause freeze to allow time for lightbox to show
setTimeout('pause(3000)', milliseconds);
}
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
}
function closeLightbox() {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
}
</script>
<a href="test.html" target="_blank" onclick="openLightbox(); delay(2000); closeLightbox(); return true;">
click here
</a>
<script>
function pause(milliseconds) {
// freezes window/execution for milliseconds given
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
function delay(milliseconds) {
// delays pause freeze to allow time for lightbox to show
setTimeout('pause(3000); closeLightbox();', milliseconds);
}
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
}
function closeLightbox() {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
}
</script>
<a href="test.html" target="_blank" onclick="openLightbox(); delay(2000); return true;">
click here
</a>
<script>
function pause(milliseconds) {
// freezes window/execution for milliseconds given
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
function delay(milliseconds) {
// delays pause freeze to allow time for lightbox to show
setTimeout('pause(3000); closeLightbox();', milliseconds);
return true;
}
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
return true;
}
function closeLightbox() {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
}
</script>
<a href="test.html" target="_blank" onclick="if(openLightbox() && delay(2000)) { return true; }">
click here
</a>
<script>
function pause(milliseconds) {
// freezes window/execution for milliseconds given
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
return true;
}
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
return true;
}
function closeLightbox() {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
}
</script>
<a href="test.html" target="_blank" onclick="if(openLightbox() && pause(3000)) { closeLightbox(); return true; }">
click here
</a>
It would be easy to use javascript redirects or popups involving "window.location...". However, I wish the link to be executed from a click and thus, I would expect there to be a way to use "return true" to execute a link some time after it is clicked ( i.e. until onClick returns true ).
<script>
function openLightbox() {
// show lightbox
document.getElementById('Box').style.display='block';
document.getElementById('Lightbox').style.display='block';
var url = this.href;
setTimeout(function () {
closeLightbox(url);
}, 3000);
return false;
}
function closeLightbox(url) {
// hide lightbox
document.getElementById('Box').style.display='none';
document.getElementById('Lightbox').style.display='none';
window.location = url;
}
</script>
<a href="test.html" target="_blank" onclick="return openLightbox();">
click here
</a>