
phpQuestioner
Members-
Posts
1,485 -
Joined
-
Last visited
Never
Everything posted by phpQuestioner
-
[SOLVED] How to catch form-submission events?
phpQuestioner replied to kratsg's topic in Javascript Help
are you submitting all of your multiplet forms at once; like with one form action or javascript function? -
you need to post php related questions in the php forum of this site. http://www.phpfreaks.com/forums/index.php/board,1.0.html
-
yes - this is one way: <script language="javascript"> function changeIt() { document.getElementById('myDIV').innerHTML='Something Else'; } </script> <div id="myDIV">Put text here.</div> <a href="javascript:changeIt()">Change Text - Click Here</a>
-
if your javascript or php is set up to create/check for the cookie and finds that a specific cookie exist; you set up a redirect based on a specific cookie's name or content. that way; as soon as the page loads or before the page loads (using server side - like php); they will be sent to the specific pagination (I assume that is what your doing with this) your ajax script sent them to; when they click the "next" button or whatever they did to trigger the ajax function.
-
here is a basic server side session validation using php: http://www.tizag.com/phpT/phpsessions.php
-
here you go: <script language="javascript"> function verify() { var first = document.myform.realname.value; var last = document.myform.lastname.value; var email = document.myform.email.value; var errors1 = ""; var errors2 = ""; var errors3 = ""; var message="Please complete the following field(s): \n"; if (first.length == "0") { errors1="First name\n"; } if (last.length == "0") { errors2="Last name\n"; } if (email.length == "0") { errors3="email address\n"; } if (errors1.length >= "1" || errors2.length >= "1" || errors3.length >= "1") { alert(message + "\n\n" + errors1 + errors2 + errors3); } else { document.myform.submit(); } } </script> <div id="formbox"> <h3>Get Your Free Gifts !</h3> <form name="myform" METHOD="post" ACTION="http://moneymakeyourich.com/cgi-bin/formmail.pl"> <input type=hidden name="recipient" value="[email protected]"> <input type=hidden name="subject" value="Your Subject"> First Name : <input type=text name="realname" size="20"> Last Name : <input type=text name="lastname" size="20"> Email : <input type=text name="email" size="20"> <input type="button" value="submit" onclick="verify()"/> </form> <p>Important:I will never share your information with anyone !</p> there's other ways to validate your form fields besides this; with more complex validation (like regex for email address fields), but this should work fine for basic validation.
-
Javascript does not handle sessions; it can handle cookies, but not sessions. You will have to validate sessions server side.
-
[SOLVED] Country State Drop Down need help with POST
phpQuestioner replied to gasma1975's topic in Javascript Help
You need to set up your php script to receive the "state" variable from this form. You will also have to add a action (yourphppage.php) and method (get or post) to this form. PS: Just like AndyB did below -
here is a good tutorial, that may help you out with this: http://www.cssjuice.com/25-rounded-corners-techniques-with-css/
-
try this: <html> <head> <title> Test Website </title> <style type="text/css"> div#menu{ background-color:#CC0000; color:#FFFFFF; } </style> <script type="text/javascript"> function showMenu(showhide){ var menu = "Menu"; var l_1 = '<a href="/" onMouseOver="showMenu(\'show\')">Home</a><br />'; var l_2 = '<a href="/about.php" onMouseOver="showMenu(\'show\')">About Us</a><br />'; var l_3 = '<a href="/contact.php" onMouseOver="showMenu(\'show\')">Contact Us</a><br />'; var l_4 = '<a href="/links.php" onMouseOver="showMenu(\'show\')">Links</a>'; var br = "<br>"; if(showhide == 'show'){ document.getElementById("menu").innerHTML=menu + br + l_1 + l_2 + l_3 + l_4 + br; } else if(showhide == 'hide'){ document.getElementById("menu").innerHTML=menu + br; } } </script> </head> <body> <table> <tr> <td> This is a Test </td> <td> This is another test </td> </tr> <tr> <td> Blah Blah Blah </td> <td> <div id="menu" onMouseOut="showMenu('hide')" onMouseOver="showMenu('show');"> Menu<br> </div> </td> </tr> </table> </body> </html>
-
you need to query your ajax script with two parameters; so that you can get news articles and the links. you will need to create a seperate ajax function; so that your links can send another query to your php file and return the responseText to your div. you will have to limit you last 5 links from your database with PHP, based on how ever you want them to display.
-
you could set a cookie based on the url and have your script check for the cookie and redirect accordingly on page load (with onload event).
-
Did you try something like this: <script language="javascript"> // Your AJAX Would Be Here function check4It() { var what = ihr.responseText; if (what == "inline") { // do something } setTimeout("check4It()", 1000); } window.onload = function() { check4It(); } </script> I will not guarantee this will work; but it might be worth a shot.
-
You can do this with PHP GD Library for image fonts; but I think your out of luck on css; it's browser based fonts (that already exist on the browser software).
-
Script not working in FireFox and Safari
phpQuestioner replied to websiteguy's topic in Javascript Help
it's because you did not give your image the id of "holder"; instead you gave it a name of "holder". try this: <script language="JavaScript"> // Gallery script. // With image cross fade effect for those browsers that support it. // Script copyright (C) 2004 www.cryer.co.uk. // Script is free to use provided this copyright header is included. function LoadGallery(pictureName,imageFile) { document.getElementById(pictureName).src = imageFile; } </script> <div id="slideshow"> <div id="scroll"><a href="#_self" onclick="LoadGallery('holder', 'images/house-back1-lg.jpg')"><img src="images/house-back1-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/house-back3-lg.jpg')"><img src="images/house-back3-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/Beach-lg.jpg')"><img src="images/Beach-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/beach-cple-lg.jpg')"><img src="images/beach-cple-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/LapPool-lg.jpg')"><img src="images/LapPool-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/Sunset-lg.jpg')"><img src="images/Sunset-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/house-front-lg.jpg')"><img src="images/house-front-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/beachpath-lg.jpg')"><img src="images/beachpath-th.jpg" /></a><a href="#_self" onclick="LoadGallery('holder', 'images/sunrise-lg.jpg')"><img src="images/sunrise-th.jpg" /></a></div> <div id="bigimage"><img id="holder" src="images/house-back1-lg.jpg" width="452" height="289" alt="Picture of Villa La Fiaca" /></div> </div> -
Here is a little bit more of an elaborate version of the original script I wrote for you. <script language="javascript"> var i = 0; var questions = new Array(); questions[1] = "<p>1) Do you feel more self-confident than usual?</p>" questions[2] = "<p>2) Do you feel happy?</p>"; questions[3] = "<p>3) Aren't you glad I wrote you this awesome script?</p>"; questions[4] = "<p>4) Add more questions in this same fashion.</p>"; function redisable() { document.getElementById('rotator').disabled = true; } function switchThru() { i=i+1; if (i < questions.length) { document.getElementById("q").innerHTML = questions[i]; document.getElementById("a").innerHTML = "<Input id=\"q1a\" class=\"checkbox\" type=\"checkbox\" value=\"1\" onclick=\"checkTotal(this.id, this.value)\">Yes<Input id=\"q1b\" class=\"checkbox\" type=\"checkbox\" value=\"0\" onclick=\"checkTotal(this.id, this.value)\">No"; } else { document.getElementById("q").innerHTML="You Have Reached The End of This Questionare."; document.getElementById("a").innerHTML=""; document.getElementById("endnote").innerHTML="Total Score: "; document.getElementById("buttonwrapper").innerHTML="<span id=\"rotator\"></span>"; } redisable(); } function checkTotal(which,what) { var aa = document.getElementById("displayer").value; var current = document.getElementById(which).value = what; var checks = document.getElementById('q1a').checked; var balances = document.getElementById('q1b').checked; var total = aa + 1; if ( aa < i) { document.getElementById("displayer").value = (current*1) + (aa*1); } if (document.getElementById('q1a').checked == true) { document.getElementById('rotator').disabled = false; } else if (document.getElementById('q1b').checked == true) { document.getElementById('rotator').disabled = false; } else if (checks == "false" || balances != "false") { document.getElementById('rotator').disabled = true; } } window.onload = function() { switchThru(); document.getElementById("displayer").value="0"; } window.onreload = function() { document.getElementById("displayer").value="0"; } </script> <div id="q"></div> <div id="a"></div> <br><br> <span id="endnote">Current Score: </span><input type="text" id="displayer" size="5" readonly value="0"> <span id="buttonwrapper"> <br><br> <input type="button" id="rotator" value="Next Question" onclick="switchThru()" disabled> </span>
-
try this: <script language="javascript"> var i = 0; var questions = new Array(); questions[1] = "<p>1) Do you feel more self-confident than usual?</p>" questions[2] = "<p>2) Do you feel happy?</p>"; questions[3] = "<p>3) Are you glad I wrote you this awesome script?</p>"; questions[4] = "<p>4) Add more questions in this same fashion.</p>"; function switchThru() { i=i+1; if (i < questions.length) { document.getElementById("q").innerHTML = questions[i]; document.getElementById("a").innerHTML = "<Input id=\"q1a\" class=\"checkbox\" type=\"checkbox\" value=\"1\" onclick=\"checkTotal(this.id, this.value)\">Yes<Input id=\"q1b\" class=\"checkbox\" type=\"checkbox\" value=\"0\" onclick=\"checkTotal(this.id, this.value)\">No"; } } function checkTotal(which,what) { var aa = document.getElementById("displayer").value; var current = document.getElementById(which).value = what; document.getElementById("displayer").value = (current*1) + (aa*1); } window.onload = function() { switchThru(); } </script> <div id="q"></div> <div id="a"></div> <br><br> <input type="text" id="displayer"> <br><br> <input type="button" value="Next Question" onclick="switchThru()">
-
no - but the original example I gave you worked fine (other then the uncompleted author's comments tag you left in there); you must have changed something. look at the original code to see if you can find your error. because all I had to do was take the javascript and add a div or a table or any html element, that allows you to change the background color, and it works perfectly fine (without any errors). http://www.phpfreaks.com/forums/index.php/topic,178342.msg793698.html#msg793698
-
it's because you do not have the id "colorize" defined, by any of your html elements, in your page
-
you can try this script I wrote; it's not a perfect science, but it will send form variables to a browser based email client via javascript. this is not the ideal way to handle/process form mail, but it may be just what your looking for. <script language="javascript"> var uremail="[email protected]"; // your email address here var sub="Opt-In"; // your email subject here // Do Not Alter Anything Beyond This Point function sendForm2WebMailClient() { var fname = document.getElementById('firstname').value; var lname = document.getElementById('lastname').value; var theiremail = document.getElementById('email').value; document.getElementById('emailsubject').value = sub; document.getElementById('emailcontent').value = 'FirstName:'+fname + '\r' + 'LastName:'+lname + '\r' + 'Email:'+theiremail; document.myform.action="mailto:"+uremail+""; document.myform.submit(); } </script> <form name="myform" method="get"> <!-- Do Not Remove Content Below --> <input type="hidden" name="subject" id="emailsubject"> <input type="hidden" name="body" id="emailcontent"> <!-- Do Not Remove Content Above --> First Name: <input type="text" name="FirstName" id="firstname"><br><br> Last Name: <input type="text" name="LastName" id="lastname"><br><br> Email: <input type="text" name="Email" id="email"><br><br> <input type="button" value="Submit" onclick="sendForm2WebMailClient()"> </form>
-
A.) Should be like this: </div> <div class="sidebar"> <div id="formbox"> <h3 align="center">Get your Free Gifts!<h3> <form METHOD="post" ENCTYPE="text/plain" ACTION="http://www.aweber.com/scripts/addlead.pl"> First Name : <input type="text" name="FirstName" size="20"> </br> Last Name : <input type="text" name="LastName" size="20"> </br> Email Address : <input type="text" name="Emailaddress" size="20"> </br> <input type="Submit" value="submit"> </form> <p>Important:I will never share your informations with anyone ! And you can unsubscribe at any time</p> </div> <div id="infobox"> <h3>Why we choose the #1 Product</h3> B.) It should; you just need to find the external javascript; which is: <script type="text/javascript" src="http://forms.aweber.com/form/25/953296625.js"></script> Delete it; and replace the empty space (where the external javascript that you just deleted was at) with your new html form. C.) You need to make sure your email address and other form variables are configured in your the perl script that processes you form. If they are not configured; you will not receive you email. And before you ask; I do not know how to configure a perl script; I know php, not perl and that is the server side language script that your original form has with it too process your form variables and send them to your email address.
-
you mean like this (not 100% sure what you mean): <a href="/yournetwork/index.php?mode=login&act=home"><font color="#FFFFFF" size="2">Home</font></a>
-
ok, I see what you did; you set the "go" variable value when the if condition occurred; but that was not the original code - that is what I didn't get.