Results 1 to 4 of 4

Thread: Help with Modal Window CSS

  1. #1
    Join Date
    May 2007

    Help with Modal Window CSS

    I'm trying to put a modal window on my webpage. I found a script on the net and it works just fine, except that when the window displays, the background page is not "washed out". I think it has to do with the opacity property, but I can't get it to work. Can someone please help with this. Here's the code:

    body {
    div.register {
        margin-left: 30%;
        background-color: #FFCF31;
        width: 450px;
        z-index: 1000;
    div.register p {
     	font-size: .8em;
    	margin: 0px 0px 0px 0px;
    div#signupForm {
     	margin: 0px 20px 0px 20px;
     	font-family: Arial, sans-serif;
     	font-size: .8em;
    a.formLink {
     	font-family: Arial, sans-serif;
    	font-size: .9em;
    function overlay() {
    	el = document.getElementById("register");
    	el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
    <body bgcolor="#848997" onload="javascript:overlay()">
    <table width="90%" background="Graphics/background.jpg" cellspacing=0 border=0>
    <tr height=150px>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;<img src="Graphics/Logo1a.gif"> <img src="Graphics/Logo2a.gif"></td><td align="right" valign="top"><a href="Consumer_Page.html"><font color="#FFFFFF" face="Arial">For Consumers</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="Business_Page.html"><font color="#FFFFFF" face="Arial">For Businesses</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="ContactUs_Page.html"><font color="#FFFFFF" face="Arial">Contact Us</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
    <td colspan=2><table bgcolor="#ffffff" width="100%" cellspacing=15 border=0>
        <td><font face="Arial" size=5 color="#3D69BF"> Connect with a Local Business</font></td>
        <td><font face="Arial" size=4>Welcome to Your Local Loop we provide homeowners with Local companies that can take care of most of their needs, whether it be home repairs, cleaning your house or yard, or replacing your roof. We feature these companies in our magazine that we mail to most homeowners.</font></td>
        <font face="Arial" size=4>
        <li>Most home owners have at least 156 local business with in a 3 mile radius of their home!</li>
        <li>Chances are you’ve shopped, attended church or have met some of thesebusiness owners <br>or employees at school or local functions!</li>
        <li>It can save you $$$ by staying local, plus time!</li>
        <td align="center"><table bgcolor="#A1BDEF" width="90%" cellspacing=15 border=0>
            <td align="center"><font face="Arial" size=5 color="#3D69BF">Watch for<img src="Graphics/Logo3.gif" align="top">magazine soon in your mail box.</font></td>
            <td align="center"><font face="Arial" size=4 color="#3D69BF">Make sure your on our list.</font></td>
            <td align="center"><a href="Mail_List.html"><img src="Graphics/ClickHere.jpg" border=0></a></td>
        <tr height=15px></tr>
    <td colspan=2 align="left" valign="middle"><a href="AboutUs_Page.html"><font color="#FFFFFF" face="Arial">About Us</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="ContactUs_Page.html"><font color="#FFFFFF" face="Arial">Contact Us</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
    <tr height=50px></tr>
    <font=-1>Copyright 2013 Your Local Loop; all rights reserved.</font>
    <div class="register" id="register">
    <div id="signupForm">
    <p style="text-align: right;"><a class="formLink" title="Sign up form" href="javascript:overlay()"><font face="Arial" size=3>close<font></a>
    <p><font face="Arial" size=5>3 reasons you should use<p>a local business!</font><p>&nbsp;<p><font face="Arial" size=3>Sign Up To Receive This Free Information Now!
    <form id="addRegistrant" action="process_form.php" method="get">
     	 Name: <input name="name"><p>&nbsp;<p>
    	 Email: <input name="Email"><p>&nbsp;
    	 <p style="text-align: right;">
    	 <input name="submit" value="Get it Now!" type="submit">

  2. #2
    Join Date
    Mar 2011
    There's no support in the code you posted that would wash out the page when the modal window is visible, and it would take major modification to add it. My advice would be to just include the sign-up form in a convenient location on the page and not worry about special effects until you learn more about HTML and CSS. Try again when you can make a page like this without using the <font> or <center> tags.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    May 2007

    Thank you for your response and advice. Hopefully, someone else will reply with some assistance rather than a critique of my coding practices.

  4. #4
    Join Date
    May 2007

    Talking Resolved!

    Hi all.

    Well, it's been a couple of days and I haven't learned not to use <font> and <center> tags .... but I have learned how to make the background page wahsed out.

    So, for those who have the same problem and whose coding does not meet up to rtrethewey's standards, here is the solution:

    1. Create your main page (with the stuff you want washed out) and enclose the code in ID'd Divs. You can do this for one or more sections of your page code.

    2. Create your window (the stuff you want to show up) and enclose the code in an ID'd Div.

    3. Add the following script in the <head> section:
    var useOpacity =
       (typeof document.createElement("div").style.opacity != 'undefined');
    var useFilter = !useOpacity
       && (typeof document.createElement("div").style.filter != 'undefined');
    function setOpacity(el, value) {
       if (typeof el == 'string')
          el = document.getElementById(el);
          value = Math.min(1, Math.max(value, 0));
          if (useOpacity)
                el.style.opacity = value;
          else if (useFilter)
                el.style.filter = "alpha(opacity=" + (value * 100) + ")";
    That's all there is to it. The function can be called from any event handler (i.e. onLoad, onClick, etc.) and is passed the ID name and the opacity value (0-1) that you want to set.

    BTW, it works in virtually all browsers, EVEN IE.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.15334 seconds
  • Memory Usage 2,889KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates