Making custom langing pages with ajax signup popups (script included)
That's where Ajax comes in and saves the day like Mightymouse...
Here's a quick ajax function that pulls your signup form page and slaps it on your landing page... and you can make it pop up in a floating <div> tag.
Ajax function.. put it in a file, link to it in your Head of your html... <script src="vAjax.js"></script>
var numnum = 0; //var numxml = 0; var requestArray = new Array(); function GetXmlHttpObject(available){ this.xmlhttp=false; this.available = available; try { // Firefox, Opera 8.0+, Safari this.xmlhttp=new XMLHttpRequest(); } catch (e){ // Internet Explorer try{ this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch (e){ this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } //return xmlHttp; } function vPage(iid,urlstr){ numxml = -1; for (var i=0; i<requestArray.length; i++){ if (requestArray[i].available == 1){ numxml = i; break; } } if (numxml == -1){ numxml = requestArray.length; requestArray[numxml] = new GetXmlHttpObject(1); } //xmlHttp = xmlArray[numxml]; var useLoad = arguments[2]; if (requestArray[numxml].xmlhttp != false){ requestArray[numxml].available = 0; requestArray[numxml].xmlhttp.open("GET",urlstr,true); requestArray[numxml].xmlhttp.send(null); requestArray[numxml].div = iid; requestArray[numxml].xmlhttp.onreadystatechange=function(){ if(requestArray[numxml].xmlhttp.readyState==4){ if (requestArray[numxml].xmlhttp.responseText != '') document.getElementById(requestArray[numxml].div).innerHTML = requestArray[numxml].xmlhttp.responseText; requestArray[numxml].available = 1; } } if (useLoad == null) document.getElementById(iid).innerHTML = '<div class="loading">Loading...</div>' + document.getElementById(requestArray[numxml].div).innerHTML; }else{ alert ("Your browser does not support AJAX"); return; } }
vAjax('signup','hxxp://your.signup/form');
Now, you have to make the div, and a way to pop it up... so you'll make a function that does two things: un-hides your div, and calls the signup form into it by the ajax call... or in this function's case, vAjax, lol...
Div for the signup popup... put this anywhere in the html, it will show up wherever you position it to in CSS... you can adjust the width, height, and positioning (top/left).
<div id="signup" style="position: absolute; top: 100px; left: 100px; width: 500px; height: 400px; display:none;"> </div>
<script type="text/javascript"> function signup(){ document.getElementById('signup').style.display=''; vPage('signup','hxxp://your.signup.com/form.html'); } </script>
<a href="#a" onclick="signup();">
Replace hxxp with http
-
khtm -
Thanks - 1 reply
{{ DiscussionBoard.errors[1320800].message }}-
divinewind -
Thanks
{{ DiscussionBoard.errors[1321469].message }} -
-
-
divinewind -
Thanks
{{ DiscussionBoard.errors[1335039].message }} -