Home / Internet & Networking / Web design / Java Script Code That Triggers Open In New Window
0 Members and 3 Guests are viewing this topic. « previous next »
Pages: 1 [2]  All - (Bottom) Print
Author Topic: Java Script Code That Triggers Open In New Window  (Read 415 times)
lina19
Rookie



Posts: 36

Experience: Beginner
OS: Unknown

« Reply #15 on: January 09, 2012, 04:48:56 PM »

or u working with only javascript??you cant do the "ip" part with javascript+ database...


u will need to add all your ips in a database/textfile by using php(server side)...
whenever a new person comes...validate this new ip with your exisiting database value..
if it is not seen in the database, open page

in php u have a function known as header( instead of window.location...something like this i forgot exactly....

else u can do this in javascript,

var [] array_list="<?php echo $array_list ?>";

var new_ip="<?php echo $newip ?>";

for (int i=0;i<array_list.length; i++)
{
 

IP logged
lina19
Rookie



Posts: 36

Experience: Beginner
OS: Unknown

« Reply #16 on: January 09, 2012, 04:52:50 PM »

for (int i=0;i<array_list.length; i++)
{
    if (array_list.equals(new_ip))
   { window.location="a.html";
  }
}

sry...i havent worked with php nor javascript for one year...i have forgotten about the syntax...but the logic is here....and i guess u can understand it as ur a programmer as well....


u can use ajax as well to do it....

u cant extract ip from javascript....its impossible...

u can use java like applets to extract ip as well...
IP logged
roco
Topic Starter
Rookie



Posts: 21


« Reply #17 on: January 09, 2012, 05:25:56 PM »

That is quite ok..You have helped me a great deal!! I wish I was a programmer lol,but I am learning as I go along. Thanks again for your help!!
IP logged
kpac
Web moderator
Moderator
Hacker



Thanked: 180
Posts: 5,874

Certifications: List
Computer: Specs
Experience: Expert
OS: Windows 7
kpac®

1 1 1
« Reply #18 on: January 10, 2012, 12:01:20 PM »

Lina, please use the CODE tag when displaying code in your posts...

Code: [Select]
// like this

Code: [Select]
window.location = "URL HERE";
This just sends the user to a new URL in the same window they are currently looking at.

Code: [Select]
window.open("URL HERE", "_blank", "width=300,height=200");
This opens a new window/tab with the specified URL. You can change the width and height if desired (in pixels).

Whether a new tab or window opens depends on the browser. I think IE opens new windows, Firefox opens tabs etc....there's no way to specify which one you want (I'm 90% sure).

To only display it once a day for each visitor is more complicated and involves using cookies to check the last time they visited the site. See Google.
IP logged

lina19
Rookie



Posts: 36

Experience: Beginner
OS: Unknown

« Reply #19 on: January 10, 2012, 12:10:56 PM »

thx kpac...but where is the "code tag"...im not finding anything to help me show my codes...thanks beforehand
IP logged
kpac
Web moderator
Moderator
Hacker



Thanked: 180
Posts: 5,874

Certifications: List
Computer: Specs
Experience: Expert
OS: Windows 7
kpac®

1 1 1
« Reply #20 on: January 10, 2012, 12:15:48 PM »

Code: [Select]
[code ]Code[ /code]

without the spaces...
IP logged

lina19
Rookie



Posts: 36

Experience: Beginner
OS: Unknown

« Reply #21 on: January 10, 2012, 12:27:58 PM »

Code: [Select]
test
IP logged
lina19
Rookie



Posts: 36

Experience: Beginner
OS: Unknown

« Reply #22 on: January 10, 2012, 12:28:24 PM »

ok thx
IP logged
Pages: 1 [2]  All - (Top) Print 
Home / Internet & Networking / Web design / Java Script Code That Triggers Open In New Window « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.092 seconds with 20 queries.