Jump to content

toolman

Members
  • Posts

    210
  • Joined

  • Last visited

Everything posted by toolman

  1. I've also tried this, but it doesn't work. My JS is not great: var newWin=new Array(); newWin[0]="website1.com"; newWin[1]="website2.com"; window.onload = function() { if (!document.getElementsByTagName) return false; var links = document.getElementsByTagName("a"); for (var i=0; i<links.length; i++) { if (links[i].getAttribute("href") == 'newWin') { links[i].onclick = function() { return !window.open(this.href); } } } }
  2. Would this be correct: if (links[i].getAttribute("href") == ('http://www.website1.com','http://www.website2.com')) {
  3. Hi, I am trying to specify three URLS in this line, but can't work out how to list them. I tried this, but it dodn't work: if (links[i].getAttribute("href") == "http://www.website1.com" || "http://www.website2.com" || "http://www.website3.com") { Any ideas how to acheive this? Thanks
  4. Hi, Is it possible to open a link in a new window using just CSS? I found this: target-new: window; but heard this isn't supported. Any ideas? Thanks
  5. Hi there, I am trying to display some javascript depending on specific domains. For example, I have several websites using the scame script, such as www.mydomain.com/website1, www.mydomain.com/website2, www.mydomain.com/website3, www.mydomain.com/website4 etc.They all use the same files. Is there a way I can use an if statement to display the javascript on say just /website2 and /website3 ? Many thanks!
  6. Hi, Is it possible to style a lable based on "for" For example, can I give this label a class of "initial" using the for="initial" attribute? <label for="initial">Initial *</label> Thanks
  7. Hi, I have this script which adds up various options in some drop down menus. However, if I select/keeps selecting an option, it add it to the total each time I select it. Is there a way I can have it so it it only adds it on once and to use an either/or method - so only one value will be added? var sum =499; var count=0; var output; function UpdateCost() { var i = document.getElementById('graphic'); sum = sum + parseFloat(document.getElementById('graphic').value); document.getElementById('result').value = sum; } function UpdateCost2() { var i = document.getElementById('transit'); sum = sum + parseFloat(document.getElementById('transit').value) ; document.getElementById('result').value = sum; } function UpdateCost3() { var i = document.getElementById('lights'); sum = sum + parseFloat(document.getElementById('lights').value) ; document.getElementById('result').value = sum; } function UpdateCost4() { var i = document.getElementById('wooden'); sum = sum + parseFloat(document.getElementById('wooden').value) ; document.getElementById('result').value = sum; } function UpdateCost5() { var i = document.getElementById('case'); sum = sum + parseFloat(document.getElementById('case').value) ; document.getElementById('result').value = sum; } Thanks!
  8. When I run it through the WC3 validator, I get this error: Line 99, Column 199: general entity "body" not defined and no default entity
  9. Hi, I am trying to validate a mailto link, but its not working. This is the code: mailto:[email protected]?subject=my subject here&body=this is the body Any ideas why it is not validating? Thanks
  10. I can't work it out. I now have this on my onsubmit: onsubmit="return (validateForm() && checkkey(this))" but I can't work out how to combine the functions.
  11. Thanks. I now have this: function validateForm() { var x=document.forms["snazzyForm"]["textfield"].value; if (x==null || x=="") { alert("First name must be filled out"); return false; } if (/\W/.test(v.value)) { alert("Please enter alphanumerics only"); return false; } return true; } } and <form name="snazzyForm" action="index.html" method="POST" onsubmit="return validateForm()" > <input type="text" name="textfield" /> </form> but it doesn't work
  12. Hi, I have this code, but I want it to validate when the form is submitted rather than when the user starts to enter text. How would I do that? function checkkey(v) { if (/\W/.test(v.value)) { alert("Please enter alphanumerics only"); return false; } return true; } <form name="snazzyForm" action="index.html" method="POST" onsubmit="return validateForm()" > <input type="text" name="textfield" onKeyUp="return checkkey(this)" /> </form>
  13. I've changed the form() to test(), but it doesn't seem to validate. The validation works if there is no text entered, but if I enter any other characters apart from letters, it submits the form.
  14. Thanks. I now have this, but it still doesn't work function validateForm() { var x=document.forms["Form"]["inputtext"].value; if (x==null || x=="") { alert("You must enter some text!"); return false; } if (/[^0-9a-zA-Z\s]/gi.Form(inputtext.value)) { alert ("Only alphanumeric characters and spaces are valid in this field"); inputtext.value = ""; inputtext.focus(); return false; } }
  15. Hi, I am trying to validate a field so the user must enter some text and also only be allowed to enter alphanumeric characters, but it doesn't work. Any ideas what I have wrong? I have this code: function validateForm() { var x=document.forms["Form"]["inputtext"].value; if (x==null || x=="") { alert("You must enter some text!"); return false; } if (/[^0-9a-bA-B\s]/gi.test(inputtext.value)) { alert ("Only alphanumeric characters and spaces are valid in this field"); fieldname.value = ""; fieldname.focus(); return false; } }
  16. Hi, I have some divs that are created automatically, but I am giving the divs a margin-right, which means the last div is breaking onto a new line. Is there a way I can give the last div it's own class?
  17. Many thanks! - it was the {literal} tag that fixed it.
  18. Its is a .tpl file, but it just seems to be that part of the code that is stopping the page working. Its a jQuery parallax script.
  19. Hi, I can't seem to get anything from firebug as the page just loads blank when I use that code
  20. Hi, When I add the following javascript, my page stops loading. I have tried adding it to various places in my page, but it doesn't seem to make a difference. <script type="text/javascript"> jQuery(document).ready(function() { $('#parallax .parallax-layer') .parallax({ mouseport: $('#parallax') }); }); </script> Any ideas?
  21. Hi, I have some images that I want to resize to a square dimention (40px 40px). However, not all image are square, so when they are resized, they lose their ration and look squashed. Is there a way I can display just a part of the original image, say 40px x 40px on the top middle of each image? I hope that makes sense
  22. I have backups, but I don't want that page on the server. I have also noticed there are other old pages missing that are linked in Google. Can I do a 301 redirect so any missing pages go to the new homepage until the website is re-spidered?
  23. Hi, I have set up a new website, but the old website is using /mainpage.html as it's homepage when searching in Google. This page no longer exists, so when a user clicks on the page in Google, the website is not found. Is there a way i can set up a forwarder to point the missing file to the new index.php page? Thanks
  24. Hi, I have this menu code which displays a drop down menu: <ul> <li><a href="<?php echo URL_PUBLIC; ?>">Home</a></li> <?php function submenu($list, $ul){ if($ul){ echo " <ul>";} foreach($list->children() as $newList){ echo ' <li>'.$newList->link($newList->title, (in_array($newList->slug, explode('/', $newList->url)) ? ' class="current"': null)); if ($newList->childrenCount() > 0) { submenu($newList, true); }else{echo "</li>";} } if($ul){echo " </ul></li>";} } submenu($this->find('/'), false); ?> <br style="clear: left" /> </ul> I am trying to exclude certain menu items based on their slug. I have this code, but can't work it into the above: $omit_pages = array('page1', 'page2'); if (in_array($menu->slug, $omit_pages)) { continue; } Does anyone have any ideas how I can work it in? Thanks
  25. I currently have a drop down menu which displays categories, but i want them to display in equal columns horizontally. How could I do that using PHP? This is what I have: <div id="menu" class="grid_12"> <ul> <?php foreach ($categories as $category) { ?> <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> <?php if ($category['children']) { ?> <div class="sixth_color_border"> <?php for ($i = 0; $i < count($category['children']) { ?> <ul> <?php $j = $i + ceil(count($category['children']) / $category['column']); ?> <?php for (; $i < $j; $i++) { ?> <?php if (isset($category['children'][$i])) { ?> <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li> <?php } ?> <?php } ?> </ul> <?php } ?> </div> <?php } ?> </li> <div class="categories_spacer"></div> <?php } ?> </ul> </div> Any ideas? 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.