0

how to do a javascript alert box that contain a button with a class like this submit button:

<input type="submit" class="lightbox">

or there is any way to make a javascript form that pop up and contain this submit button?

user2687618
  • 59
  • 3
  • 13

2 Answers2

1

I would use this code:

var doc = document, htm = doc.documentElement, bod = doc.body;
function E(e){
  return doc.getElementById(e);
}
function winOpen(clickId, url, name, height, width){
  var ht = innerHeight || htm.clientHeight || bod.clientHeight;
  var wd = innerWidth || htm.clientWidth || bod.clientWidth;
  ht = (height-ht)/2; wd = (width-wd)/2;
  E(clickId).onclick = function(){
    open(url, name, 'height='+height+',width='+width+',top='+ht+',left='+wd);
  }
}
// You would use this like 
winOpen('newWindow', 'wherever.html', 'windowName', 500, 500);

whatever.html should be the page with your lightbox class.

StackSlave
  • 10,613
  • 2
  • 18
  • 35
1

Standard browser alerts are not stylable - it will have to be done in code. If you don't want to window.open a new page and willing to use a 3rd party library - jQueryUI is a good choice. The Dialog is fully stylable- yes, including button.

Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136