This is a discussion on "help needed with Javascript" within the JavaScript Forum section. This forum, and the thread "help needed with Javascript are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
help needed with Javascript
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hi
My name is Julia Andersson. I'm creating a new business website and need some help with javascript. What I am wanting to do is have my site pop up a message when a person leaves asking them if they want to navigate away from the page or stay and join my mailing list. but I'd also like to know if it is possible to have one of those checkboxes on it allowing regular visitors to turn it off. (keeping in mind the 20/80 rule that 20% of customers provide 80% of sales... I really don't want to be annoying those ppl with the pop up... if that's what you call it) I have used something similar on another site as a warning prior to them visiting a certain page and the script I used was
Could somebody please help me with this. Thank you Julia Last edited by karinne; Aug 13th, 2007 at 12:24. Reason: Please use [ code ]...[ /code ] tags when displaying code. It's easier to discern code from content ;) |
|
|
|
|||
|
Re: help needed with Javascript
Okay, I've had a look around and attempted to create a script for this purpose (excluding the turn off function which I still need help with... if it's even possible to do it)
Here's the script
Julia Last edited by karinne; Aug 13th, 2007 at 12:24. Reason: Please use [ code ]...[ /code ] tags when displaying code. It's easier to discern code from content ;) |
|
|||
|
Re: help needed with Javascript
Oh, one other thing... can I throw in an exclusion to the script... for example if the visitor is simply visiting another page on my site
and don't forget the other unanswered one about whether I can allow visitors to turn the script off altogether on their computer Thanks for the help Julia |
|
|||
|
Re: help needed with Javascript
Your script looks ok but I have a few questions.
Whatever you decide, we'll be happy to help. Good Luck, Scott |
|
|||
|
Re: help needed with Javascript
Quote:
In answer to your questions, the mailing list form is on the page that they would be leaving (actually it will be on every page within my site.. because it's in the sidebar, hence not needing the script to run if they're visiting an internal link) And I was thinking along the lines of a "Don't display this message again" option. If you want to have a look at the site visit http://www.free-electronics-source.com I'm not sure that it will come up for you yet though because the filename isn't 'index.html' or anything like that (it comes up on my computer but for some reason not on my daughters when I type in the url). The sidebar contains a picture of the mp3 and the blurb about joining the free mailng list to receive regular updates and a chance to win it. In any case, the point may be moot since I attempted to install that script but it didn't work. I may need to change the format of my page. My ecommerce coach suggested the blog format but I'm finding it somewhat limiting. Even if I decide not to use the javascript, my current format has nowhere to include meta tags and meta keywords for the benefit of SEO. While there are conflicting reports as to the effectiveness of such tags in increasing SE rankings I still want to include them... just in case. Thanks again Julia Oh, just to clarify... the blog format I'm using is WordPress Last edited by JewelEnterprises; Aug 12th, 2007 at 23:41. Reason: adding clarification about WordPress |
|
|||
|
Re: help needed with Javascript
Ok, heres my opinion (for what it's worth). I like the idea of having the image in the sidebar with the option for signing up for the newsletter. Since you want to use javascript for your prompt, I would use cookies.
Good Luck, Scott |
|
|||
|
Re: help needed with Javascript
Quote:
Sincerely Julia |
|
|||
|
Re: help needed with Javascript
OK, I'll give you the code for setting a cookie to get you started.
I didn't test this, just threw it together. Good Luck, Scott |
|
|||
|
Re: help needed with Javascript
Quote:
So using that I would not need to worry about having a "do not show this prompt again" option... it would happen automatically? Julia |
|
|||
|
Re: help needed with Javascript
Okay, something has gone skewiff... I added this script to my index.php file
So I removed it again. I tried adding it to my sidebar in a text file with the same result. The prompt came up when my page loaded unstead of when it unloaded. So I removed it again!! What am I doing wrong? Is it the script or something else. HELP ME PLEEEEEEEAAAAAAAAAASSSSSSSEEE LOL Julia Last edited by JewelEnterprises; Aug 13th, 2007 at 12:59. Reason: another post edited for not using the code tags |
|
|||
|
Re: help needed with Javascript
Dang I hate website development sometimes LOL
Heheh, but what is life without a little challenge? Julia |
|
|||
|
Re: help needed with Javascript
Ha Ha, isn't programming fun? I would take that function and put it in an onUnload handler in your body tag. Also I see no need to use writeIn for your prompt. Just put it right in the prompt.
As for your other question. All you need to do is a loop (if your familiar with loops) and check the value of the cookie. If the value is 1 do not show the message, otherwise show the message. If the value is 0, make sure you change the value of the cookie to 1. |
![]() |
| Tags |
| help, javascript |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with Javascript menu needed! | themightymac | JavaScript Forum | 1 | Jan 26th, 2008 14:53 |
| Designers needed, cloners needed. | TargeTemplate | Job Opportunities | 0 | Dec 27th, 2007 03:41 |
| what does + + mean in Javascript eg: var m = (A1+ +B4); | Andy K | JavaScript Forum | 6 | Dec 13th, 2006 23:57 |
| Can someone help me with this javascript | Galaxyblue | JavaScript Forum | 2 | Mar 11th, 2004 12:18 |
| Javascript | mikegu | JavaScript Forum | 1 | Oct 16th, 2003 08:19 |