Jump to content

danny_woo

Members
  • Posts

    23
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

danny_woo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, I am currently going through the Lynda Learning Jquery Essential training course. I have completed all the lessons in the first chapter however on the last lasson in the chapter that puts everything together in a practical example I cant get it to work properly. This is really anoying as i have spent all my free time this week studying. Anyway, the lesson/code should work like this, display a small PDF icon next to every href element in the document the has the .pdf extension. However when i preveiw the code below none of the pdf images are displayed. This is the code: <!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> <title>Automatic PDF Icons</title> <style type="text/css"> li { margin: 5pt 0 0 5pt; } </style> <script type="text/javascript" src="js/jquery-1.9.1.js"></script> <script type="text/javascript"> $("document").ready(function() { $("a[href$=.pdf]").after("<img src='images/small_pdf_icon.gif' align='absbottom' />"); }); </script> </head> <body> <h1>Example: Automatic Insertion of Icons for PDF Links</h1> <p>This example demonstrates how to examine the contents of a link to see if it points to a PDF file and automatically insert a PDF icon if it does.</p> <ul class="navlist" id="navlinks"> <li><a href="someurl.html">Link #1</a></li> <li><a name="#anchor1">Named Anchor Link</a></li> <li><a href="someurl.html">Link #2</a></li> <li><a href="someurl.pdf">Link #3</a></li> <li><a href="someurl.html">Link #4</a></li> <li><a href="someurl.html">Link #5</a></li> <li><a href="someurl.pdf">Link #6</a></li> <li><a href="someurl.html">Link #7</a></li> <li><a href="mailto:joe@joe.com">Email Link</a></li> </ul> </body> </html> Hope you guys can help me out on this one, I was really enjoying learning Jquery up until now. Many thanks in advance.
  2. So just to clarify, I would like to amend the above javascript to only allow the following types of input: +44 (0) 111 1234 or... 441111234 Thank you.
  3. Thanks for your help man. I have used your code and everything is cool with the email Regexp. I then set an new Regexp for the 'Phone Number' field. I searched the web for a code to just allow numbers and right now what I am using is this expression: var reg = /[0-9]/; The problem is though, with this expression it is still allowing for letters. So for example you could type the following in the input field and it would display correct: 123456abc // As long as there are numbers in the field it returns positive or true. So on this basis, I changed the regexp to another regexp that I found on the web, however this code did let me input only numbers but if you separated the number it will display incorrect: 123 132 133 // Returns false. I have spent the last two hours online looking for a regexp that will allow users to input numbers only and also allow white space between the numbers, however I am now more confused than ever. Please can some one tell me what would be the correct regexp to use if I want it to accept only numbers but also allow white space between the numbers? Many thanks in advance.
  4. Hi people, Please could some one help me out with a bit of javascript and a simple contact form. I found this code on youtube and it's really cool however at the moment i can only get it to work with the 'email address' validation. What it does is, if you enter a correct email format a green tick image displays and if you enter an incorrect email address format it displays an X for incorrect. Also if the field is blank, by default it displays the X image. What I would like to do is the same sort of thing but for a few more fields in my contact form. Obviously these fields have different requirements, than having to enter a valid email format. For example in the 'phone number' field I would like it to only accept numbers and maybe () and + symbols. //Just in case someone enters a country code number format +44 (0) 207 for example. Anyway I hope this all make sense, I tried to do this on my own but I cant seem to get it working right as I am very new to javascript. Many thanks to anyone who can help me out, Cheers. <html> <head> <script type="text/javascript"> var status = document.getElementById("status"); var email = document.getElementById("email"); function checkEmail(email) { var reg1 = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if(reg1.test(email) == false) { document.getElementById("status").src = "/images/bad.png"; } else if(reg1.test(email) == true) { document.getElementById("status").src = "/images/ok.png"; } } </script> </head> <body> <form action="process_form.php" method="post"> <table width="500" cellspacing="5" cellpadding="0"> <tr> <td>Email Address:</td><!--Has to be a valid email address format to display the 'ok' image --> <td><input type="text" id="email" name="email" onkeyup="checkEmail(this.value);" onblur="checkEmail(this.value);" maxlength="60" size="30"/></td> <td><img src="images/bad.png" alt="Status" id="status" style="margin-left:5px; vertical-align:middle;" /></td> <td> </td> </tr> <tr> <td width="136">Account Number:</td><!--Has to be more than 4 characters long --> <td width="144"> </td> <td width="48"> </td> <td width="145"> </td> </tr> <tr> <td>Name:</td><!--No numbers and has to be more than 4 characters long --> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Phone Number:</td><!--Should only allow numbers and the following characters: + () --> <td> </td> <td> </td> <td> </td> </tr> </table> </form> </body> </html>
  5. Thanks for posting the code mate. I will play around with it this weekend and do some reading up on what you have given me. Thanks for helping the newbe out.
  6. ok cool, thanks for your quick reply man. Can you give me a quick example of using fopen(), fgets() and (intval) with what i want to do please? You dont have to write the whole code if its a hassle, but could you give me a rough starting point please mate. I'll read into it later to get a better idea. Thank you very much for your help.
  7. Hi people, I'm still going through the long learning curve of understanding of PHP so please go easy on me! Right now I'm going through a course to help me on my way and i have recently gone through a lesson which briefly covered the 'implode" and 'explode' functions in regards to an array. Anyway, I have been thinking and was wondering if I could somehow use PHP to clear up some data for my own personal use. What i mean is, I have a list of data, lets say it looks like this: #John Smith 1.5.55.1.101 #Ben Chen 1.7.8.55.4.1 #Tim Roberts 155.587.5.5 #Terry Noble 9.44.47.7.6 #Harry Flint 9.5.44.10.7 ...And so on. Maybe about 100 entries in total. Is there a way i could write a php script that i can add this data to or that the script could fetch this data and then remove all the information except for the numbers at the bottom of each entry and then echo the result to my local host so it looks something like this: 1.5.55.1.101 1.7.8.55.4.1 155.587.5.5 9.44.47.7.6 9.5.44.10.7 This is really just an expirement, if it is possible I would love to know where to start, so i can start playing around with this. Again If it is possibe what i would like to do eventually is add a function that removes duplicates. The list of data is not on a database or anything, its just on a text file and I dont really wanna put it on a database. I guess i could add it to the top of my php script right as some kind of string? Or am i going off track? I hope some one can point me in the right direction, so I have something to work with and understand. Thanks in advance guy's and girls.
  8. Thanks for the replies guys. You have got me thinking about this project in a whole different way now. I think what I'm going to do is start with the database and have a clear thought-out plan about the tables and fields I'll need along with an overall general plan for the entire project. Also I plan to get up to scratch on MySQL as I'm no expert in this area (this entire project is to get me learning a bit more about PHP and MySQL) so a bit of extra reading wont hurt. Once things are underway and I start to run into php errors I'll keep coming back to you guys and PHP Freaks to hopefully point me in the right direction! Once again, many thanks for your input guys, if you have any more thoughts on this subject please post. Cheers.
  9. Hello People, I have an idea to write some code to enable some friends and family to upload and download photo's from a part of my website. What I would like to do is have about 6 registered members (all of whom know each other). Once one of these members logs in, they will be able to see the other members photo albums and will have the option to download individual photo's or complete photo albums from the 5 other members. Lastly the logged in user will also have the option to upload their own photos to their own album for the other members to download if they wish to do so. Now, I know there are plenty of Photo Sharing Websites and even some servers provide an almost similar service and all-in-all it would save me a great deal of time, and I'm sure a great deal of stress and frustration but I'm a stubborn bastard and I wish to do this project myself because: 1) I really need to improve on my PHP and 2) I want to keep this restricted and have complete control over everything. 3) Build a simple photo sharing site with no bells and whistles attached. Now i know this can be done in many different ways, but what I would like to know from the PHP experts is what would be the best approach for me to start putting this together? I've done a little digging around on the internet and what I'm thinking is to follow a tutorial Ive found, then once completed start modifying the code to suite my above requirements. The tutorial i found was on youtube under the title: How to make a PHP Upload system for your website (Part 1) (HD) http://www.youtube.com/watch?v=SD2B-hDxw4M The tutorial is in 3 parts. If anyone is interested in helping me on this project, please have a look at the tutorials and kindly let me know if this is the best place for me to start my project. Many thanks in advance people. PS, one thing i forgot to mention, but is kinda obvious is that each member would require a separate Username and Password.
  10. Hi guys, So i got this problem with my form. It's a simple form for subscribing to a part of my website. Basically the form consists of 2 input fields, one is 'Name' and the other is 'Email Address' and the submit button is an image. The problem I have is at the bottom of my form I have two options: <label><input type="radio" name="subscription_status" value="radio" id="subscription_status_0")>Subscribe</label> (This selection is for users to Subscribe to the service) and next i have: <label><input type="radio" name="subscription_status" value="radio" id="subscription_status_1")>Subscribe</label> (This selection is for users to Unsubscribe to the service) What i want to do is if the user selects the "Subscribe" option and then his submit I want a message to popup saying something like "Thank you for subscribing". However if the user selects the "Unsubscribe" option and then hits submit I want a message to popup saying something like "Your subscription has been canceled". At the moment I can only work out how to get one message to popup when you hit the submit button. I need to understand how i can display the right message for the right selection. I hope someone can help us out on this one, I'm really new to java script so please go easy on me! Many thanks.
  11. I have the same issue my friend. I'm having problems with DST and offsetting the time, I posted on Friday and after 40 something views I'm still no better off. I'll be watching this topic with interest. Best of luck mate, I hope someone can help us out.
  12. Hi guys, Please can some one help me out here! I'm slowly going crazy. I'm new to java script, but I'm sure there is a way to do this. I have some code for a digital clock and all is well and good with it. No problems. However I need to repeat or modify this code two more times, so I have a total of 3 working digital clocks on one webpage. In addition to this I need the other two clocks to display different times. So for example, the 1st clock is set to New York time, the 2nd clock is set to London time and the 3rd clock is set to Hong Kong time. I think this can be done with offsetting the time, but I'm not sure where to put the command and how to write it to my code properly. Also when I try to add a second clock, the first one disappears! I know there is also another way of doing this with php, if anyone has the time to change this code to php I'll be very grateful, if not please can someone tell me where I'm going wrong in JavaScript. Hope someone can help me out, Cheers people, here's the code: <head> <title>Slowly Going Insain</title> <style type="text/css"> .clockStyle{ background-color:#FFF; padding:5px; color:#F00; font-family:"Times New Roman", Times, serif; font-size:10px; font-weight:normal; letter-spacing: 2px; display:inline; } </style> </head> <body> <h2>Global Time...</h2><br/> <table width="380" cellspacing="2" cellpadding="2"> <tr> <th width="35%" align="left" valign="top" scope="col">London</th> <th width="34%" scope="col">New York</th> <th scope="col">Hong Kong</th> </tr> <tr> <td height="20" align="left" valign="top"><div id="clockDisplay" class="clockStyle"></div></td> <td align="left" valign="top"> </td> <td align="left" valign="top"> </td> </tr> </table> <script type="text/javascript" language="javascript"> function renderTime(){ var currentTime = new Date() var diem = "AM"; var h = currentTime.getUTCHours(); var m = currentTime.getUTCMinutes(); var s = currentTime.getUTCSeconds(); if (h == 0) { h = 12; } else if (h > 12) { h = h - 12; diem = "PM"; } if (h < 10) { h = "0" + h; } if (m < 10) { m = "0" + m; } if (s < 10) { s = "0" + s; } var myClock = document.getElementById('clockDisplay'); myClock.textContent = h + ":" + m + ":" + s + " " + diem; myClock.innerText = h + ":" + m + ":" + s + " " + diem; setTimeout('renderTime()',1000); } renderTime(); </script> </body> </html>
  13. Thanks for your reply man, I asked one of the hosting companies and they said the have recently updated there version on php and Apache in addition to this the system I'm working with was built by some one else a few years ago, so it most certainly was built using a older version of PHP. I'm am hoping that this may be the reason some things have started to stop working. My friend is going to look into the code and see if he can update it for me, but how about you guys, does you agree that its a problem with old php script or could it be something else instead? Any suggestions are welcome. Thanks guys.
  14. Hi guys, I, not sure if this post belongs here as I have no idea what the cause of my problem is. However I'm hoping i can post the problems i have and one of you guys might be able to point me in the right direction as to where the problem is. Anyway up until a few days ago i had a system set up using php and mysql for customers to login to there accounts, buy and sell items etc. Every time a client would buy or sell an item a conformation email would automatically be generated and sent out with all the correct info already saved in the email. This system would also save the buy or sell information and a system administrator could login and view this info. The problem I have right now is that, none of this information is being saved any more, and the emails are not being generated. A client can do anything they want but no details are being saved. This problem just came out of nowhere, one day its was working fine, as it has been for well over a year now and then BANG! Its not working any more. Another strange thing is that I cant even seem to login into the administrator area on any other browser than firefox? I have really no idea why that is. I would also like to add that I have made no changes to the php code or the sql data prior to this problem. and lastly I think i should mention that this same system is on another completely different server, and the system has the exact same problem. If anybody has any clues to this one, or point me in the right direction I would be most grateful, as it has me completely stumped. Thank you very much in advance.
  15. Just to confirm, that did the trick. Thanks for the advice , I know it was pretty basic stuff that I should of already known but thanks for helping me out dude. The people on this forum kick ass. Love you guys. Cheers. Danny.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.