Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ultraspoon

Members
  • Joined

  • Last visited

  1. I found this code on the internet to display the date. <script type="text/javascript"> var d = new Date() var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") document.write(weekday[d.getDay()] + " ") document.write(d.getDate() + ". ") document.write(monthname[d.getMonth()] + " ") document.write(d.getFullYear()) </script> I was wondering how to make the text white and font Tahoma? Is this possible? Thanks
  2. I personally have no idea how this can be done, so I don't know where to start any research, so hopefully someone can point me in the right direction. I am going to create an interactive Google map, where the user can move and place the pin wherever they want on the map.(Which I can do). Then, when they click send, the website will then either, print screen the Google map and send me the image file. OR send me the information of where the pin is via longitude and latitude. The top method is preferred but If this cannot be done, I can live with the last. Any suggestions will be greatly appreciated and if there are any other methods in which could be used, any pointers would be great. Thank you.
  3. Once again Skateside I'm in your debt. I really like how you only gave me the smallest amount of code to help me, so that Id have to figure out the rest on my own. This is what I came up with, and it works perfectly. function addExtraRevised(){ var cost = parseFloat(document.getElementById("price").value); var a = document.extras.option1.checked var b = document.extras.option2.checked var c = document.extras.option3.checked var result = 0; // our default value if ( a ) {result += 1;} // if a is true, add 1 to our value if ( b ) {result += 2;} if ( c ) {result += 4;} if(result == 1) {var newCost = cost + 20.00; document.getElementById("newPrice").value = newCost.toFixed(2); }else if(result == 2) {var newCost = cost + 9.25; document.getElementById("newPrice").value = newCost.toFixed(2); }else if(result == 4) {var newCost = cost + 10.00; document.getElementById("newPrice").value = newCost.toFixed(2); }else if(result == 3) {var newCost = cost + 29.25; document.getElementById("newPrice").value = newCost.toFixed(2); }else if(result == 6) {var newCost = cost + 19.25; document.getElementById("newPrice").value = newCost.toFixed(2); }else if(result == 5) {var newCost = cost + 30.00; document.getElementById("newPrice").value = newCost.toFixed(2); }else if(result == 7) {var newCost = cost + 49.25; document.getElementById("newPrice").value = newCost.toFixed(2); } } There might be a more compact way to code it but I'm happy we did it! Thanks a bunch.
  4. Ok so after I completed my form I decided to try and better myself in JavaScript and make my form a little more advanced. The first three parts in my If statement work fine, but the last one does not, I guess ive made a mistake with the operators used. I'm pretty sure its obvious what I'm trying to accomplish by just looking at the code. function addExtra() { var cost = parseFloat(document.getElementById("price").value); var a = document.extras.option1.checked var b = document.extras.option2.checked var c = document.extras.option3.checked if(a == true) {var newCost = cost + 20.00; ///This one works document.getElementById("newPrice").value = newCost.toFixed(2); }else if(b == true){ var newCost = cost + 9.25; ///This one works document.getElementById("newPrice").value = newCost.toFixed(2); }else if(c == true){ var newCost = cost + 10.00; ///This one works document.getElementById("newPrice").value = newCost.toFixed(2); }else if(a == true && b == true) { var newCost = cost + 29.25; ///This one does not work document.getElementById("newPrice").value = newCost.toFixed(2); } } I know my coding is very well, bad, but I am only learning AND I did get this first three here working all on my own. Thank you
  5. Works perfectly Skateside. Thank you so much, :yahoo: I owe you big time.
  6. Ok So ive given this a go now. I think I may have some code in the wrong place. This is what I have right now. This is the HTML Page. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script src="costcalcscript - Switch.js" type="text/javascript"></script> <script> // JavaScript window.onload = function() { // The id attribute of the form. This will fire when you press the submit button document.getElementById('guideform').submit = function(e) { // Fire your function and pass it the value of the drop down box myFunction( document.getElementById('guidelinks').value ); // Stop the form submitting and the page changing return false; }; }; </script> </head> <body> Choose your Window Style: <form id="guideform" name="guideform" method="post" action=""> <select id="guidelinks" name="guidelinks"> <option selected value="style1">Style 1</option> <option value="style2">Style 2</option> <option value="style3">Style 3</option> <option value="style4">Style 4</option> <option value="style5">Style 5</option> <option value="style6">Style 6</option> </select> <input type="submit" value="Fire my function!"> </form> <br /> <br /> Enter the Height of your Window in: (mm) <input id="height" type=text size=10> <br /> <br /> Enter the Width of your Window in: (mm) <input id="width" type=text size=10> <br /> <br /> <input type="button" value="Calculate" onclick="style1()"> &nbsp Total Cost in: (£) <input id="price" type=text size=10> </body> </html> This is my javascript script // JavaScript Document function myFunction(value) { var useHeight = parseFloat(document.getElementById("height").value); var useWidth = parseFloat(document.getElementById("width").value); var mightBeNumber = isNaN(useHeight); var result = useHeight * useWidth; switch(value) { case 'style1': if (mightBeNumber){ alert("Sorry! Not a number"); } else if(result <= 660000){ var price = 0.000342; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 660000 && result <= 800000){ var price = 0.000272; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 800000 && result <= 1000000){ var price = 0.000221; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1000000 && result <= 1560000){ var price = 0.000171; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1560000 && result <= 1950000){ var price = 0.000139; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1950000){ var price = 0.000121; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } break; case 'style2': if (mightBeNumber){ alert("Sorry! Not a number"); } else if(result <= 250000){ var price = 0.0007; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 250000 && result <= 360000){ var price = 0.000545; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 360000 && result <= 500000){ var price = 0.000413; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 500000 && result <= 650000){ var price = 0.000329; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 650000 && result <= 800000){ var price = 0.000273; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 800000 && result <= 1040000){ var price = 0.000210; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1040000 && result <= 1430000){ var price = 0.000176; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1430000){ var price = 0.000144; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } break; // Continue like this to take care of each value } } Am I doing this right Skateside? Thanks
  7. Ok, So I gave this a go last night, and im unsure on how to implement Skatesides code with mine. This is the code that I have so far, and it works perfectly. Im just struggling on making it a bit more complicated. Like I said in my next post, there are going to be more window styles, I want the user to select the window, insert their measurements and then click the calculate button, depending on what style they chose, determines what code is implemented. Such as function style 1, or function style 2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" language="javascript"> function style1(){ var useHeight = parseFloat(document.getElementById("height").value); var useWidth = parseFloat(document.getElementById("width").value); var mightBeNumber = isNaN(useHeight); var result = useHeight * useWidth; if (mightBeNumber){ alert("Sorry! Not a number"); } else if(result <= 550000){ var price = 0.00041; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 500000 && result <= 660000){ var price = 0.00037; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 700000 && result <= 840000){ var price = 0.00031; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 850000 && result <= 990000){ var price = 0.000269; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1000000 && result <= 1150000){ var price = 0.000235; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } else if(result >= 1150000 && result <= 1130000){ var price = 0.0002; var cost = price * result; document.getElementById("price").value = cost.toFixed(2); } } </script> Choose your Window Style: <FORM name="guideform"> <SELECT name="guidelinks" size="1"> <OPTION SELECTED value="style1">Style 1 <OPTION value="style2">Style 2 <OPTION value="style2">Style 3 <OPTION value="style2">Style 4 <OPTION value="style2">Style 5 <OPTION value="style2">Style 6 </SELECT> <br /> <br /> Enter the Height of your Window in: (mm) <input id="height" type=text size=10> <br /> <br /> Enter the Width of your Window in: (mm) <input id="width" type=text size=10> <br /> <br /> <input type="button" value="Calculate" onclick="style1()"> &nbsp Total Cost in: (£) <input id="price" type=text size=10> </head> <body> </body> </html> Thanks a lot guys. I know there must be something so simple im missing.
  8. Haha, Brilliant, Thank you so much skateside, I believe this is exactly what I need. So Im going to go give this a go now. If I get stuck with the awesome code you have provided me, can you possibly help me out some more? Thanks again Spoon
  9. So, What I need to know is, when I create a number of events in Javascript, such as 'function style1(){' and 'function style2(){' in the same html page, is there a way I can use a drop down box like this: <FORM name="guideform"> <SELECT name="guidelinks" size="1"> <OPTION SELECTED value="style1">Style 1 <OPTION value="style2">Style 2 <OPTION value="style2">Style 3 <OPTION value="style2">Style 4 <OPTION value="style2">Style 5 <OPTION value="style2">Style 6 </SELECT> To select which code is executed when the button is pressed? I hope you understand, Thanks.
  10. Hello all. I've been set a task to make a website, and on it I need to create a Cost calculator for windows. Now I have a price matrix for some of the windows, but they are a set price, like £233 for a 500mm by 1100mm Firstly how do you think I would start this calculator and do you think I would need to work out how much it would cost per mm to start the calculations. I have no idea on how to start or accomplish this and this is the only thing I need to do to complete this site. Any help would be greatly appreciated. Thank you.
  11. ultraspoon posted a topic in Server Side
    Hey Folks, Ive set up an IPN for my website and tested it through Paypal sandbox, it seems to be working but not completly, the php script I have adds the user to the database and it should also email the buyer their password for the login. The script adds the details to the database but no email is recieved. Here is my ipn.php script. <?php mysql_connect("blank.blank.blank", "blank", "blank") or die(mysql_error()); mysql_select_db("blank") or die(mysql_error()); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // PAYMENT VALIDATED & VERIFIED! $email = $_POST['payer_email']; $password = mt_rand(1000, 9999); mysql_query("INSERT INTO users (email, password) VALUES('". mysql_escape_string($email) ."', '".md5($password)."' ) ") or die(mysql_error()); $to = $email; $subject = 'Download Area | Login Credentials'; $message = ' Thank you for your purchase Your account information ------------------------- Email: '.$email.' Password: '.$password.' ------------------------- You can now login at blank/'; $headers = 'From:blank' . "\r\n"; mail($to, $subject, $message, $headers); } else if (strcmp ($res, "INVALID") == 0) { // PAYMENT INVALID & INVESTIGATE MANUALY! $email = $_POST['payer_email']; $password = mt_rand(1000, 9999); mysql_query("INSERT INTO users (email, password) VALUES('". mysql_escape_string($email) ."', '".md5($password)."' ) ") or die(mysql_error()); } } fclose ($fp); } ?> Thanks guys.
  12. Thanks for your reply andyl. Any chance you could explain in depth on what you mean exactly? Thanks again.
  13. Hey everyone, Glad to join your forum and hope you can help. Im making a website(this is made in flash) and this uses php and mysql to login which works fine. Now what I need to do is when the users login they have option to subscribe to my service, when the users subscribe to my service and pay via paypal, they will be able to login again with the same login form but instead of being directed to the option to subscribe to the service page, they will be redirected to another page to buy my products. Im not quite sure how to do this and any help would be appreicated.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.