Question subject: First Visit Pop Up Window javascript code
Posted: Sun Oct 19, 2008 11:47 pm
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 57 time
If you're looking for a JavaScript code to enable you to create a first visit pop up window for your web site, you've come to the right place.
Pop up windows can provide a great way to gain new subscribers to your publication and even increase your sales. However, they can also be very irritating to your visitors.
For this reason, you may want to use a pop up window JavaScript code that will only load the pop up window on your visitor's first visit. That way you're not continually harassing them with a pop up window each time they visit your web site.
Place the following JavaScript code within the <BODY> of your web page.
Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development function GetCookie(name) { var arg=name+"="; var alen=arg.length; var clen=document.cookie.length; var i=0; while (i<clen) { var j=i+alen; if (document.cookie.substring(i,j)==arg) return "here"; i=document.cookie.indexOf(" ",i)+1; if (i==0) break; } return null; } var visit=GetCookie("COOKIE1"); if (visit==null){ var expire=new Date(); window.name = "thiswin"; newwin=open("yourpagename.html", "dispwin", "width=450,height=455,scrollbars=yes,menubar=no"); expire=new Date(expire.getTime()+7776000000); document.cookie="COOKIE1=here; expires="+expire; } // --> </SCRIPT>
Edit the JavaScript code for your first visit pop up window to suit your needs.
Replace the words "yourpagename.html" with your pop up window address and edit the window's width and height to your desired size.
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
tiffanly
Question subject: Re: First Visit Pop Up Window javascript code
Posted: Wed Aug 05, 2009 12:42 pm
Joined: Mon Aug 03, 2009 6:11 pm Posts: 1 Has thanked: 0 time Have thanks: 0 time
Anyone have javascript that will allow me to rotate pictures on a website? I have a basic site and am just looking to rotate the images on the page and have been told Javascript will do this. Does anyone have the code, and instructions on how to do this? Using Dreamweaver if it matters ___________ yahoo keyword tool ~ overture ~ traffic estimator ~ adwords traffic estimator
Last edited by tiffanly on Fri Aug 07, 2009 12:09 pm, edited 1 time in total.
msi_333
Question subject: Re: First Visit Pop Up Window javascript code
Posted: Thu Aug 06, 2009 1:39 am
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 57 time
to rotate image with javascript : i found the following code that may help you alot :
Code:
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin var interval = 2.5; // delay between rotating images (in seconds) var random_display = 1; // 0 = no, 1 = yes interval *= 1000;
var image_index = 0; image_list = new Array(); image_list[image_index++] = new imageItem("img/image-cycler/rotate1.jpg"); image_list[image_index++] = new imageItem("img/image-cycler/rotate2.jpg"); image_list[image_index++] = new imageItem("img/image-cycler/rotate3.jpg"); image_list[image_index++] = new imageItem("img/image-cycler/rotate4.jpg"); var number_of_image = image_list.length; function imageItem(image_location) { this.image_item = new Image(); this.image_item.src = image_location; } function get_ImageItemLocation(imageObj) { return(imageObj.image_item.src) } function generate(x, y) { var range = y - x + 1; return Math.floor(Math.random() * range) + x; } function getNextImage() { if (random_display) { image_index = generate(0, number_of_image-1); } else { image_index = (image_index+1) % number_of_image; } var new_image = get_ImageItemLocation(image_list[image_index]); return(new_image); } function rotateImage(place) { var new_image = getNextImage(); document[place].src = new_image; var recur_call = "rotateImage('"+place+"')"; setTimeout(recur_call, interval); } // End --> </script> </HEAD>
the idea is to save 4 different copies of the image (for example , 4 different rotations with 0, 90 ,180 , 270 ) and change the displayed one when an event triggered .
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )