Switch to full style
HTML,DHTML,Javascript,XML,CSS
Post a reply

First Visit Pop Up Window javascript code

Sun Oct 19, 2008 11:47 pm

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.



Re: First Visit Pop Up Window javascript code

Wed Aug 05, 2009 12:42 pm

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.

Re: First Visit Pop Up Window javascript code

Thu Aug 06, 2009 1:39 am

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>


<BODY OnLoad="rotateImage('rImage')">



<center>
<img name="rImage" src="img/image-cycler/rotate1.jpg" width=120 height=90>
</center>





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 .

Post a reply
  Related Posts  to : First Visit Pop Up Window javascript code
 Reload a Window With a Button javascript code     -  
 new window using javascript     -  
 open/close new window using javascript     -  
 Javascript code with Unity3D     -  
 Preloading Images javascript code     -  
 Redirect to a New Page javascript code     -  
 Typing Status Bar Text javascript code     -  
 Back to previous page javascript code     -  
 Status Bar Link Description javascript code     -  
 Javascript Code For Moving Images On Click Of A Button     -