/    Sign up×
Community /Pin to ProfileBookmark

A humble request…

I’m trying to help my buddy put together a website, and while I’m decent at basic HTML and graphic design, my javascripting really sucks. So if you guys could help me I’d really appreciate it…

My buddy wants a pop-up to appear when a person leaves his site that asks the visitor why they chose not to download his free software. (There would be a list of 5 or 6 choices with checkboxes next to them, and an open field at the bottom for “Other”.)

The user could then click (using checkboxes) any number of items, or fill in an other field and then click submit. Not only do we want this data sent to us, but we would also like for text to appear in that same pop-up window to respond to the user’s objections immediately.

For example, if the user clicked two checkboxes that said:

  • I don’t think I can install this
    and…

  • I’m afraid this is just a virus
  • …two pieces of text would appear in the same pop-up window that basically said “Trust me you can install it, we’ll show you how.” and “I promise on my grandmother’s grave that this is not a virus.” (Our rebuttals would obviously be longer, but you get the idea.)

    So like I said, if anyone knows how to do this or already has the script then I’d really appreciate the help.

    Thanks guys and gals,
    Ryan

    to post a comment
    JavaScript

    4 Comments(s)

    Copy linkTweet thisAlerts:
    @pyroMay 02.2003 — [i]Originally posted by nodyce [/i]

    [B]wants a pop-up to appear when a person leaves his site that asks the visitor why they chose not to download his free software.[/B][/QUOTE]
    Probably because they don't want it. Seriously, all a popup like that will do is annoy visitors, and make those who are using Mozilla with it's popup blocker happy... You'd be better of making a faq page to answer these questions for them...
    Copy linkTweet thisAlerts:
    @nodyceauthorMay 02.2003 — I understand all the arguments against pop-ups, but this is what my friend wants.

    If you can set your hatred of pop-ups aside I'd still really appreciate the help. If not, that's ok. ?

    -Ryan
    Copy linkTweet thisAlerts:
    @brendandonhueMay 02.2003 — It won't let you do multiple checkboxes, but that shouldnt be too hard either.

    Try this code. This is the code that goes in the popup window. Use the javascriptsource.com popup generator to gen. the code to launch the popup.

    <html>

    <title>Survey</title>

    Please tell us why you have chosen not to download any of our great software. We appreciate your feedback.

    <br>

    <form>

    <input type="checkbox" name="install" onclick="javascript:document.write('Its easy to install! Heres the instructions')">Its too hard to install.<br>

    </form>

    </html>
    Copy linkTweet thisAlerts:
    @fakeNameMay 03.2003 — Try this. It shows and hides divs based on input from user.

    Div positioning needs work in Opera 5+ and Netscape, but this is the idea. The divs show and hide in these browsers but the top position is off.

    You show and hide divs based on whether a checkbox is checked. The div contains your reply to the would-be consumer's concerns.

    So, you need to learn 1) How to show and hide layers

    2) How to reference forms and form widgets.

    3) How to configure some kind of form-to-mail cgi for processing your form data to be sent to your bud by email.

    Check out Matt Wright's ubiquitous FormMail script at:

    http://www.scriptarchive.com/formmail.html

    As I said, it's a little rough, but I'm sure someone else will chime in ;-).


    <html>

    <head>

    <title></title>

    <script language="JavaScript" type="text/javascript">

    <!--

    // div show and hide routine

    function showDiv(layerName)

    {

    if (document.getElementById)

    { //is NS6+,ie5+,opera 5+

    var el = document.getElementById(layerName)

    el.style.visibility = "visible"

    }

    else if (document.all)
    { //is ie4
    var el = document.all.layerName
    el.style.visibility = "visible"
    }

    else if (document.layers)
    { //is ns4.x
    document.layers[layerName].visibility = "show"
    }

    }


    function hideDiv(layerName)

    {

    if (document.getElementById)

    {

    var el = document.getElementById(layerName)

    el.style.visibility = "hidden"

    }

    else if (document.all)

    {

    var el = document.all.layerName

    el.style.visibility = "hidden"

    }

    else if (document.layers)
    {
    document.layers[layerName].visibility = "hide"
    }

    }

    function isChecked()

    {

    // traverse the document object to the form and call showDiv and hideDiv

    // shortcut reference to form

    var form = document.whyNot

    if (form.reasons[0].checked)
    {
    showDiv("tooBusyDiv")
    }
    else
    {
    hideDiv("tooBusyDiv")
    }


    if (form.reasons[1].checked)
    {
    showDiv("notUnderstandDiv")
    }
    else
    {
    hideDiv("notUnderstandDiv")
    }

    if (form.reasons[2].checked)
    {
    showDiv("sureItsFreeDiv")
    }
    else
    {
    hideDiv("sureItsFreeDiv")
    }

    if (form.reasons[3].checked)
    {
    showDiv("afraidVirusesDiv")
    }
    else
    {
    hideDiv("afraidVirusesDiv")
    }

    }

    //-->

    </script>

    </head>

    <body onLoad="isChecked();">

    <h1>So. Why didn't you download software today?</h1>

    <p>You didn't download any software, and we'd <strong>really, really</strong> like to know why.

    Perhaps we can answer your questions or concerns</p>


    <form name="whyNot" action="cgi-bin/FormMail.pl">

    <input type="checkbox" name="reasons" value="tooBusy" onClick="isChecked()">I was too busy<br><br>

    <input type="checkbox" name="reasons" value="notUnderstandHow" onClick="isChecked()">I didn't understand how to download the program<br><br>

    <input type="checkbox" name="reasons" value="sureItsFree" onClick="isChecked()">I don't believe it is free<br><br>

    <input type="checkbox" name="reasons" value="afraidOfViruses" onClick="isChecked()">I'm afraid of viruses. What if this is a hoax?<br><br>

    </form>


    <div id="tooBusyDiv" style="position: absolute; top: 120px; left: 50px; visibility: hidden">

    <strong>We're sorry to have bothered you. Maybe when you have time you'd like to try our free software.</strong>

    </div>

    <div id="notUnderstandDiv" style="position: absolute; top: 155px; left: 50px; visibility: hidden">

    <strong>[Insert download instructions here]</strong>

    </div>

    <div id="sureItsFreeDiv" style="position: absolute; top: 190px; left: 50px; visibility: hidden">

    <strong>No, really. Free is free. That means no money. We won't hassle you, but, if you like it,

    you can contact us at...</strong>

    </div>

    <div id="afraidVirusesDiv" style="position: absolute; top: 225px; left: 50px; visibility: hidden">

    <strong>This is really not a virus, our contact info is real, we are not delinquent hackers. We

    really just want to give you our free software. Really. You can trust us. Contact us if you like

    at...and confirm that we are above board.</strong>

    </div>

    </body>

    </html>
    ×

    Success!

    Help @nodyce spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...