Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 3:02 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 3 posts ] 
Author Question
 Question subject: First Visit Pop Up Window javascript code
PostPosted: Sun Oct 19, 2008 11:47 pm 
Offline
Mastermind
User avatar

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 )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: First Visit Pop Up Window javascript code
PostPosted: Wed Aug 05, 2009 12:42 pm 
Offline
Newbie
User avatar

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.

TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: First Visit Pop Up Window javascript code
PostPosted: Thu Aug 06, 2009 1:39 am 
Offline
Mastermind
User avatar

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>


<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 .

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 3 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Need to Display Content using JavaScript in HTML page  Scripting Language  stankov  0
 java project code  Java  Anonymous  0
 Read your gmail using Java code  Java examples  msi_333  5
 getting gst, pst total to diplay in my javascript form  Scripting Language  Anonymous  0
 What's wrong with my code?  Java  Anonymous  3

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team