i having trouble editing landing page. need visitor select age. 24 or older , go step 2, if select under 24 sent http://www.google.com example. if not select answer pop-up saying "select answer".
<form action="index.php" method="post"> <div class="select-holder"> <div class="select-wrap"> <select name="age"> <option value="select answer" selected="selected">select answer</option> <option value="1">i 24+ years old. let me in!</option> <option value="5">i under 24 years old.</option> </select> </div> </div> <input value="continue" class="submit-button" type="submit"> </form>
at bottom of page:
<!-- move javascripts bottom faster page loading --> <script src="js/jquery-1.8.2.min.js" type="text/javascript"></script> <script src="js/html5.js" type="text/javascript"></script> <script src="js/functions.js" type="text/javascript"></script> <script src="js/silentpopslim.js" type="text/javascript"></script> <input type="hidden" id="hidlocation" value="{your cpvlab domain here}" /> <script type="text/javascript" src="/js/function.js"></script> <!-- // populated functions.js when user selects age in // second step, when renders, tracks user's age.--> <img id="cpvlab_pix" src=""> <img src="{your url track direct visitors page}" />
this function.js. not sure selected option triggers outcome (not programming terminology please work me here.
$(function() {
$(document).on('focusin', '.field, textarea', function() { if(this.title==this.value) { this.value = ''; } }).on('focusout', '.field, textarea', function(){ if(this.value=='') { this.value = this.title; } }); $(document).on('click', '.submit-button', function(){ if($('select').find('option:selected').index() == 0) { alert('select answer.') return false; } if($('select').find('option:selected').index() != 1) { window.location('http://www.google.com'); return false; } else { // $('.header_wrapper').slideup(); $('.step-1').hide(); // $('.step-2').fadein(200); $('.step-2').fadein(800); return false; } });
});
here html5.js step 2, presume?
/*! html5 shiv pre3.5 | @afarkas @jdalton @jon_neal @rem | mit/gpl2 licensed uncompressed source: https://github.com/afarkas/html5shiv */
(function(a,b){function h(a,b){var c=a.createelement("p"),d=a.getelementsbytagname("head")[0]||a.documentelement;return c.innerhtml="x"+b+"",d.insertbefore(c.lastchild,d.firstchild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createelement,f=a.createdocumentfragment,g=f();a.createelement=function(a){l.shivmethods||c(a);var f;return b[a]?f=b[a].clonenode():e.test(a)?f=(b[a]=c(a)).clonenode():f=c(a),f.canhavechildren&&!d.test(a)?g.appendchild(f):f},a.createdocumentfragment=function("h,f","return function(){var n=f.clonenode(),c=n.createelement;h.shivmethods&&("+i().join().replace(/\w+/g,function(a){return b[a]=c(a),g.createelement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentshived?a:(l.shivcss&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;zoom:1}mark{background:#ff0;color:#000}")),g||(b=!j(a)),b&&(a.documentshived=b),a)}function p(a){var b,c=a.getelementsbytagname(""),d=c.length,e=regexp("^(?:"+i().join("|")+")$","i"),f=[];while(d--)b=c[d],e.test(b.nodename)&&f.push(b.applyelement(q(b)));return f}function q(a){var b,c=a.attributes,d=c.length,e=a.ownerdocument.createelement(n+":"+a.nodename);while(d--)b=c[d],b.specified&&e.setattribute(b.nodename,b.nodevalue);return e.style.csstext=a.style.csstext,e}function r(a){var b,c=a.split("{"),d=c.length,e=regexp("(^|[\s,>+~])("+i().join("|")+")(?=[[\s,>+~#.:]|$)","gi"),f="$1"+n+"\:$2";while(d--)b=c[d]=c[d].split("}"),b[b.length-1]=b[b.length-1].replace(e,f),c[d]=b.join("}");return c.join("{")}function s(a){var b=a.length;while(b--)a[b].removenode()}function t(a){var b,c,d=a.namespaces,e=a.parentwindow;return!o||a.printshived?a:(typeof d[n]=="undefined"&&d.add(n),e.attachevent("onbeforeprint",function(){var d,e,f,g=a.stylesheets,i=[],j=g.length,k=array(j);while(j--)k[j]=g[j];while(f=k.pop())if(!f.disabled&&m.test(f.media)){for(d=f.imports,j=0,e=d.length;j",f="hidden"in c,f&&typeof injectelementwithstyles=="function"&&injectelementwithstyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getcomputedstyle?getcomputedstyle(b,null):b.currentstyle).display=="none"}),g=c.childnodes.length==1||function(){try{b.createelement("a")}catch(a){return!0}var c=b.createdocumentfragment();return typeof c.clonenode=="undefined"||typeof c.createdocumentfragment=="undefined"||typeof c.createelement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivcss:c.shivcss!==!1,shivmethods:c.shivmethods!==!1,type:"default",shivdocument:k};a.html5=l,k(b);var m=/^$|\b(?:all|print)\b/,n="html5shiv",o=!g&&function(){var c=b.documentelement;return typeof b.namespaces!="undefined"&&typeof b.parentwindow!="undefined"&&typeof c.applyelement!="undefined"&&typeof c.removenode!="undefined"&&typeof a.attachevent!="undefined"}();l.type+=" print",l.shivprint=t,t(b)})(this,document)
add unique id select
<select name="age" id="age-select">
then use onchange
javascript event
$('#age-select').change(function() { if ($(this).val() == 1) { alert("you can enter"); } else { alert("you cannot enter"); } });
i've no idea has html 5 , bunch of javascript pasted @ end of question related to.
Comments
Post a Comment