Jump to content

manick

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by manick

  1. Thanks I'll look into itNick
  2. Can anybody please tell me where I am going wrong, I am trying to set a cookie on a flash intro page to basically say if I have been here before, go straight to the main.html page.As ever, any help much appreciated!!function chkcook(){ if (document.cookie.beenbefore !='TRUE'){ }else { window.location="main.html"; return false } //stop hiding--> </script> <script > <!--hide function previousCookie (name, value) { // number of days the cookie should last var expDays = 180; var exp = new Date(); exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000)); expirationDate = exp.toGMTString(); // Set cookie with name and value provided // in function call and date from above document.cookie = name + '=' + escape(value) document.cookie += '; expires=' + exp.toGMTString();}I AM THEN TRYING TO CALL THEM WITH THE FOLLOWING:<<body onload="SetCookie('wishlist',cookieString)";"chkcook()";"onblur="previouscookie('beenbefore','TRUE')";>Many thanksNick Trenam
  3. many thanks for that raimo and blue, am now trying it out to see where i am going wrong!!!All your help is very much appreciated.RegardsNick Trenam
  4. Hey all,Thanks for that, am i to assume that this must have a full url to work i.e. www.whatever.com/whatever, the reason i ask is because unfortunately all i have ot work with is a personal area on the Open University site that starts http://ouserver/myname/page.html. The reason I ask is because i have tried both of the ways you 2 have ssuggested but it still does the same thing.Raimo with regard to your code what do the following lines of code do:var x = document.referrer.split('/');x = x[x.length - 1];x = x.split('?')many thanks again for your help.Regards nick
  5. Hi all,Sorry about this, we did have a thread going on this, and thought it was sorted, however I now have managed to test the following script on a live server and it just keeps opening up the index.html page, regardless of where it opens the pages from. Any help much appreciated as to where I am going wrong:function checker(){var x=document.referrerif ((x=="main.html")||(x=="wishlist.html")||(x=="prodblank.html")||(x=="form.html")||(x=="product1.htm")||(x=="index.html")){ return true} else {window.location="index.html";return false} }many thanksNick Trenam
  6. ahhh!! that makes sense now, thanks scottNick
  7. Hi all,I have the following basic script for document referrer, and regardless of where the page has been loaded from it refers me back to the index page, can someone please tell me what i m missing!!function checker(){var x=document.referrer;if ((x=="main.html")||(x=="wishlist.html")||(x=="prodblank.html")||(x=="form.html")||(x=="product1.htm")) { return true} window.location="index.html";return false} Many thanks in advanceNick Trenam
  8. Hi there,thanks for that, but unfortunately, the remit says that I have to validate as the user enters data rather than on submit (I have already had to show that I can perform on submit) , therefore that is the problem i am having with the onblur event. Is there a better way handler than onblur that will not return an error, but will force the user to enter data (i.e. onchange won;t do what I need it to do.TaNick
  9. Hi all,I have to validate three form fields on the fly, i thought about using onblur but it blobs it!!! how do you go about validating fields on more than one field without it going into an endless loop, here is the code i am using so you can see the problem i am encountering:<script>var regexp=/^[A-Z]{1,2}\d{1,2}\s{0,}\d[A-Z]{2}$/ifunction chkPC(shipPostCode){if (!regexp.test(shipPostCode.value)) {shipPostCode.value="Please enter PostCode";shipPostCode.focus();return false}return true}</script><script>function chkAddy(shipDelivery) {if ((shipDelivery.value=="Enter the delivery address.")||(shipDelivery.value=="")||(shipDelivery.value=="Please enter your correct Shipping Address")) {shipDelivery.value="Please enter your correct Shipping Address";shipDelivery.focus();return false}else{return true;}}</script><script>var cardexp=/^\d{4}\s{0,}\d{4}\s{0,}\d{4}\s{0,}\d{4}$/function chkCard(billCardNumber){if (!cardexp.test(billCardNumber.value)) {billCardNumber.value="Please enter your credit card number";billCardNumber.focus();return false}return true}</script>Im using onblur, but obviously as the user tries to go onto the next field (which also has onblur) if they have filled it out incorrectly, the browser locks.Any help much appreciated!!Manick
  10. Hi Scott,I managed to get my original code working by taking out a link to an external script. The problem I can't get my head around is using a mix of external scripts and functions in the header, If I have a link to an external script in the script tag in the head, the functions in the head when called return an "object expected" error. Thanks mateyNick
  11. yeah sorry, but as I say I've got to do it unfortunately, I'm beggared then cos I can't get it working??!??!??!?many thanksnick
  12. Hi again Scott,Unfortunately it's part of the project i am doing that it has to throw an alert up! CheersNick
  13. Hi all,I have the following in the head: function chkName(billFamilyName){ if (billFamilyName.value=="") { alert("Please write your name") billFamilyName.focus() }}and this in the body: <td><input type="text" onblur="chkName(this)" name="billFamilyName" maxlength="30"></td>but it is returning an object expected on the onblur, can someone give me an idea as to what I have done wrong, I am assuming it's something to do with whats in the () but am not sure. Any help appreciated.Tanick
  14. K, Thanks again Scott
  15. Hi Choobakka, You're not doing the OU TT281 course by any chance are you??????Nick T
  16. Hi all,Me again (js newbie), I am trying to validate info entered into a form but again am fairly clueless, can anybody tell me if I am anywhere near?regexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/function ismail(isit){ if (regexp.test(form.billEmailAddress.value)){ return true } return false }function isname(isit){ if (isit==""||isit==null) return false }function istel(isit){ var num = "0123456789() ";for (var intLoop = 0; intLoop < form.billPhoneNumber.value.length; intLoop++) {if (-1 == num.indexOf(form.billPhoneNumber.value.charAt(intLoop))) return false} function validate() {if (isname(form.billFamilyName==false) {alert ("Please enter your surname");form.billFamilyName.focus();return false;}if ismail(form.billEmailAddress==false) {alert ("Please enter a valid Email Address");form.billEmailAddress.focus();return false;}if (istel(form.billPhoneNumber==false){alert ("please enter a valid telephone Number");form.billPhoneNumber.focus();return false;} return true;}I'm still a bit clueless about how it gets the info from the form as well If anybody has got any pointers?Many thanksNick Trenam
  17. Hi again,Ok that works when added to the page, my next (REALLY basic) question is this, I am using this on several pages (obviously), I can;t seem to find anywhere on teh web how to call to more than one ecternal JS file at a time, is it anything like this???<script src="linkrollover.js";"checker.js" language="javascript" type="text/javascript"> window.onload="checker()"i.e is it a semicolon to seperate them or something else?? I appreciate this is a basic question but I just cannot find the answer.I'm assuming it's not cos it aint working!!Again, any help much appreciated.nick trenam
  18. Ok will do, sorry for being a thicket but what part does the "i" play in the matchpart of the script after "mysite.html/" ??
  19. Thanks guys,It was good to know that i wasn't too far off as well, maybe i do know slightly more than I thought (not much though!!). This is for an assignment which won't be going on a live site, so I won;t be able to check it, but as you guys know what yo are doing, I'll stick it on as is.Again, many thanksNick Trenam
  20. Hi all,I am a total novice and need help please!, I am rubbish at JS but need to get a paper in on it in a couple of weeks.I am trying to do a piece of script that checks to see if a user has entered in through the home page. Basically in my script I am trying to say has the user linked from one of the pages in the site, if not then a boolean is false and the user is redirected to the main page (index.html)Here is the code I have come up with, I appreciate it is probably way out but I can't test it! any help VERY much appreciated!!External.jsvar beenbefore =new Boolean function beenbefore(){if (document.referrer = "code.html||main.html||wishlist.html||prodblank.html||form.html||product1.htm") return beenbefore(true)}anypage.htmlbeenbefore(){if beenbefore = false}window.location(index.html)Nick Trenam
×
×
  • Create New...