Jump to content

toolman

Members
  • Posts

    210
  • Joined

  • Last visited

Everything posted by toolman

  1. Hi there, Thank you for the reply. Thanks, that works great with the text if its already set. However, If I try to pull it through using the WordPress function I have, It outputs the whole text. This is what I tried: <?php $text = wpjm_the_job_description(); $words = array_slice(explode(' ', $text), 0, 15); echo join(' ', $words) . '…'; ?>
  2. Hi, Thanks for the replies. I'm happy with the one I have above, so if there is a way I can truncate that, that would be ideal. With regards to phpmillion, it is outputting everything, but what I meant was the code I have is not doing anything, so I guess I have something wrong with it. I am happy the character count, but ideally word count would be better.
  3. Hi there, I'm trying to truncate some text by 15 words which is then followed by a "..." This is the line that outputs all the text: wpjm_the_job_description(); I've tried this, but nothing is happening. <?php $desc=wpjm_the_job_description(); echo substr($desc, 0, 15); ?> Any ideas what I have wrong? Thanks
  4. Hi there, I have the following select: <select name="place"> <option value="place1">Place 1</option> <option value="place2">Place 1</option> <option value="place3">Place 1</option> <option value="place4">Place 1</option> </select> What I would like to do is display another select dropdown if either option "place2", "place3" or "place4" is selected. How would I do this? Thanks!
  5. Hi, I don't have PHP, I only want to work with jQuery :/ I've managed to create this: var urls = window.location.href; $("a").each(function() { var $this = $(this); var _href = $this.attr("href"); $this.attr("href", _href + urls.substring(urls.lastIndexOf('/') + 1)); }); This sort of works on the following code: <a href="/sub/page.shtml" onClick="window.open('/sub/page.shtml', ''); return false; trackOutboundLink(this, 'Outbound Links', 'my link');" >Link</a> However, the window.open event causes the link to lose the appended URL. How can I apply the above to append the URL in the window.open? Thanks
  6. Hi there, I have the following URL: http://www.website.com/?code=code1&ref=myref&utm_source=email&utm_medium=direct&utm_campaign=test What I would like to do is add the ?code=code1&ref=myref&utm_source=email&utm_medium=direct&utm_campaign=test part of the URL to specific links on the page based on their ID's. The ?code= and ?ref= are dynamic, so I would need to get the URL as a dynamic URL. What would be the best way to do this? Thanks!
  7. The website has over 100,00 pages - not all have a global library with jQuery included, so I wanted to see if I could use native JavaScript. Initially I thought jQuery was included on all pages, but it's not. I have a JS include globally, but because the website is so old, I need to work with something without jQuery if possible.
  8. Thanks for the reply. After posting this, I realised, I may not have jQuery cookie plugin installed. Basically, a page loads with a URL for example of: http://www.website.com/cookie_name This then inserts a cookie called cookie_name with a value of cookie_value E.G: http:www.website.com?agent=john This then gives the cookie "cookie_name" a value of "john" What I would like to do is to use an if statement based on if the cookie has a value of "john" to do something; replace a one line of HTML. Not sure if that helps?
  9. Hi there, I have a page which displays some text based on a cookie that is set. What I would like to do is to over-ride that text/html by using an if statement based on the cookie value. I have the following, but not having any luck with it: if ($.cookie('cookie_name')=='cookie_value'){ alert("true"); $("#box").html("new text"); } Ideally, I'd like to use JavaScript rather than jQuery due to limitations. Any ideas? Thanks!
  10. Hi there, I have the following code: <select id="location" name="drop"> <option value="loc1">Location 1</option> <option value="loc2">Location 2</option> <option value="loc3">Location 3</option> <option value="loc4">Location 4</option> <option value="loc5">Location 5</option> <option value="loc6">Location 6</option> <option value="loc7">Location 7</option> </select> <select id="second" name="term"> <option value="OPT1">Option 1</option> <option value="OPT2">Option 2</option> <option value="OPT3">Option 3</option> <option value="OPT4">Option 4</option> </select> What I would like to do is to show the second select field only when "Location 5" is selected in the first drop down. How would I do this? Thanks
  11. Hi there, I have a form which I would like to append a variable to the end of the URL after it is submitted. To do this, I would like to use a select drop down: <select id="ddl" name="term"> <option selected="selected" value="all">Please Select...</option><option value="1">Option 1</option><option value="2">Option 2</option><option value="3">Option 3</option><option value="4">Option 4</option><option value="5">Option 5</option> </select> The variable I would like to add to the end of the URL would be: &option=1, &option=2 etc depending on the selected item. How would I go about doing this? Thanks!
  12. Thanks this works when the user chooses another option and then selects the default, but is there a way to create the alert if the default value is left when submitting the form?
  13. Hi there, I have the following line which insets an option to the top of a select. What I would like to do is to check if this value is left as the default and return an alert or a validation message asking the user to select an option apart from the default. $("select[name='ap']").prepend("<option value='' selected='selected'>Default option</option>"); What would be the best way to do this? Thanks
  14. toolman

    z-index issue

    Hi, I have the following code: <div class="cover" style="position: absolute; z-index: 200"></div> <div class="slide"> <img src="image.png" style="position: absolute; z-index: 50" /> <h1 style="position: absolute; z-index: 500">heading</h1> </div> I would like the <h1> to appear on top of the image and above the <div class="cover"> For some reason, it is not appearing on top of the "cover". Any ideas why?
  15. Hi, I am wanting to set a cookie based on a dynamic URL, e.g http://www.website.com/?ref=cookieval I then want to replace an image on the page with an image using the name of the cookie, e.g <img src="/images/cookieval.png" /> How would I do this? I think I can use $(".banner").html("<img src="/images/cookieval.png"); But I don't know how to set the cookie from the URL and then use it in the jQuery .html() part. Any ideas how I would do this? Thanks!
  16. Hi, I have a URL which pulls through some dynamic items, for example: http://www.website.com/page.shtml?code=home&ref=ref1&utm_source=direct&utm_medium=email&utm_campaign=weekly The ref=ref1 is a cookie, but I have an issue when going off that page and visiting another. The cookie somehow gets reset and results in it becoming undefined. What I would like to do is to append two links on the page with page2.shtml?code=home&ref=ref1&utm_source=direct&utm_medium=email&utm_campaign=weekly and page3.shtml?code=home&ref=ref1&utm_source=direct&utm_medium=email&utm_campaign=weekly so that the links will carry through the ref= and other items. I have read that I can use 'document.location.search', but I'm not sure how to do this, or if I can use jQuery either. Any ideas on how I can do this? Thanks!
  17. Hi, I have an input field on a page which I have then added to another page in an iframe. How can I make the field submit in the window that has the iframe in instead of inside the iframe? Many thanks!
  18. Hi, I have the following code which I would like to insert into a field/hidden field. var now = new Date(); now.setDate(now.getDate()); document.getElementById("s_creation_date").innerHTML = now; I have the following HTML: <input type="text" name="s_creation_date" id="s_creation_date" /> I tried using the getElementbyId, but it didn't work. Any ideas? Thanks!
  19. Many thanks for the help. It worked when I used the if(isset($_POST['submit-button-name-for-the-form-posting'])) method. Thanks!
  20. They all seem to have values. This is form code: Form 1: <form method="post" action="" id="signup"> <fieldset> <label>Name:</label> <input name="name" type="text" id="name" /> <label>Company:</label> <input name="company" type="text" id="company" /> <label>E-mail:</label> <input name="email" type="text" id="email" /> <label>Telephone:</label> <input name="telephone" type="text" id="telephone" /> <!-- The following field is for robots only, invisible to humans: --> <p class="robotic" id="pot"> <label>If you're human leave this blank:</label> <input name="robotest" type="text" id="robotest" class="robotest" /> </p> <input type="submit" value="Send Message" class="submit" /> </fieldset> </form> Form 2: <form method="post" action=""> <fieldset> <label>Name:</label> <input name="name_s" type="text" id="name_s" /> <label>Company:</label> <input name="company_s" type="text" id="company_s" /> <label>E-mail:</label> <input name="email_s" type="text" id="email_s" /> <label>Telephone:</label> <input name="telephone_s" type="text" id="telephone_s" /> <label>Message:</label> <textarea name="message_s" id="message_s"></textarea> <!-- The following field is for robots only, invisible to humans: --> <p class="robotic" id="pot"> <label>If you're human leave this blank:</label> <input name="robotest_s" type="text" id="robotest_s" class="robotest" /> </p> <input type="submit" value="Send Message" class="submit" /> </fieldset> </form>
  21. Hi, I have the following form on my page which works fine. if($_POST){ $to = 'me@me.com'; $subject = 'Signup'; $from_name = $_POST['name']; $company = $_POST['company']; $from_email = $_POST['email']; $telephone = $_POST['telephone']; $message = "New Signup Detials" . "\r\n\r\n" . "Name :" . $_POST['name'] . "\r\n\r\n" . "Email: " . $_POST['email'] . "\r\n\r\n" . "Telephone: " . $_POST['telephone']"; $robotest = $_POST['robotest']; if($robotest) $error = "You are a gutless robot."; else{ if($from_name && $from_email && $message){ $header = "From: $from_name <$from_email>"; if(mail($to, $subject, $message, $header)) $success = "You are human and your message was sent!"; else $error = "You are human but there was a problem sending the e-mail."; }else $error = "All fields are required."; } if($error) echo '<div class="msg error">'.$error.'</div>'; elseif($success) header ("location: contactthanks.php"); } I have also have another form on my page with the following: if($_POST){ $to_s = 'me@me.com'; $subject_s = 'Support Request'; $from_name_s = $_POST['name_s']; $company_s = $_POST['company_s']; $from_email_s = $_POST['email_s']; $telephone_s = $_POST['telephone_s']; $message_s = "New Signup Detials" . "\r\n\r\n" . "Name :" . $_POST['name_s'] . "\r\n\r\n" . "Email: " . $_POST['email_s'] . "\r\n\r\n" . "Telephone: " . $_POST['telephone_s'] . "\r\n\r\n" . "Comments: " . $_POST['message_s']; $robotest_s = $_POST['robotest_s']; if($robotest_s) $error = "You are a gutless robot."; else{ if($from_name_s && $from_email_s && $message_s){ $header_s = "From: $from_name_s <$from_email_s>"; if(mail($to_s, $subject_s, $message_s, $header_s)) $success = "You are human and your message was sent!"; else $error = "You are human but there was a problem sending the e-mail."; }else $error = "All fields are required."; } if($error) echo '<div class="msg error">'.$error.'</div>'; elseif($success) header ("location: contactthanks.php"); } However, I am getting a duplicate "All fields are required" message appear and the form is not submitting. Any ideas how can the code similar for each form? Thanks!
  22. Hi, I'm not sure if I should open a new post for this, but I have two forms on the same page, one with an extra field and the details get submitted to a different email address. What would be the best way to have two lots of the above code on the page? Thanks
×
×
  • 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.