If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Creating a modal window

Hello,

I have code that I am using to create a modal window. The way I was taught the code used a button to open the modal window. How would I modify the code to have it open when clicking a link? Here is the code:

Neither button had an onclick event initially in your code so I assumed the javascript sets this. If not then you would simply add 'openModal()' to the onclick event in the code above. Everything else should function as usual.

"Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

You want to re-style a button so that it looks more like an anchor (link) element than a button?

If your button has the id attribute with value set to mybutton:

#mybutton { background:none;border:none;color:#rrggbb }

All you are doing is making your button element look like a link, rather than actually using an anchor element. Alternative, you can use an anchor element with an onclick event handler defined as attribute.

Neither button had an onclick event initially in your code so I assumed the javascript sets this. If not then you would simply add 'openModal()' to the onclick event in the code above. Everything else should function as usual.

Thanks for your response but I am having one other issue. I have a dropdown list that has the links that are going to open the modal windows. As I have it coded, the modal Mask is only masking the menu area and not the entire page. Also, when I hover off of the menu to the location of the modal window it disappears (closes) without me clicking on anything.

I am trying to use SimpleModal to create the modal windows on my site. Please everyone forget the previous posts as I have scrapped that code. I have not learned Javascript or Jquery yet so this is so confusing to me. I am a php guy and cant seem to figure out what is going on with this code. It says that it is a simple plugin that creates a modal window. First off, where do I put this code:

When I try to do this it says that the url /javascript does not exist on this server. So what am I doing wrong? Does the javascript go in the head of the page its being called or right before the link that is being clicked? I am getting frusterated as I have coded my entire forum with php, html, and css and I would like to implement some modal windows for certain functions such as registration, forgoten passwords and such. If someone could please help me out that would save me so much time. If anyone is familiar with http://simplemodal.plasm.it/ that is where I got the code that I am using.