It is currently Wed Feb 08, 2012 5:55 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Please answer some JavaScript programming questions:
PostPosted: Mon Jan 21, 2008 11:09 pm 
Offline

Joined: Sat Feb 26, 2005 12:36 am
Posts: 305
Please answer some JavaScript programming questions:
1: how in js I do "every 3 visits prompt with a popup window to register" If register ofcourse no popup again. I want math for every 3 visits ONLY ?
2: How I write js code[not html] in a popup from opener , dynamically ?
3: In a password/username login what event handler(onChange() ?) to use for when after inserting username if exist cookie with this then fullfill password immediatelly WITHOUT leaving text box of username ?
4: How I transfer vars from js (eg from cookies) to PHP ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 22, 2008 11:46 pm 
Offline

Joined: Sun May 02, 2004 11:34 pm
Posts: 6500
Location: toronto, canada
1. how are you tracking the visits? that will determine if JS can pop up a window

2. http://www.java2s.com/Code/JavaScript/D ... Window.htm

3. onload to fire the event to look for the cookie

4. http://www.quirksmode.org/js/cookies.html

_________________
Lostboy

Cat, the other other white meat

Please read Posting Etiquette before posting

You can always try Google


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 23, 2008 3:15 pm 
Offline

Joined: Sat Feb 26, 2005 12:36 am
Posts: 305
1) using cookies
2) this writes html , to write js in other popup window what to do ?
3) I mean fire even when you type in "username" field (ofcourse when a cookie matched) without leaving the field(without blur)
4)How I transfer vars from js (I do not want to learn about cookies) to PHP (eg I get through prompt() the user name and use it in php processing eg "shopping cart complete check out process" greeting) ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 5:57 am 
Offline

Joined: Sun May 02, 2004 11:34 pm
Posts: 6500
Location: toronto, canada
1.
Code:
<script language='javascript'>
function popup()
{
  var thsCookieCount = readCookie('myCounter');
  if (thsCookieCount){
    if (thsCookieCount >2) newWindow();
  }

}

function newWindow()
{
  window.open(url,name, parameters);
}
function readCookie(name) {
   var nameEQ = name + "=";
   var ca = document.cookie.split(';');
   for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
   }
   return null;
}


</script>
</head>
<body onload="popup();">


2. For this I would recommend using an external js file and call functions in that file, rather than attempting to write js between windows

3. onKeyPress, onKeyDown, onKeyUp, onFocus are all functions that you could us

4. add them to a hidden field or append them to the url in form action

_________________
Lostboy

Cat, the other other white meat

Please read Posting Etiquette before posting

You can always try Google


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 11:22 am 
Offline

Joined: Sat Feb 26, 2005 12:36 am
Posts: 305
You say, "2. For this I would recommend using an external js file and call functions in that file, rather than attempting to write js between windows " well how this, tell me with "key main statements only" ? How call js functions for the popup win, from opener ?


Top
 Profile  
 
 Post subject: http://www.weberforums.com/ftopic11632.html&highlight=
PostPosted: Tue Feb 19, 2008 12:10 am 
Offline

Joined: Sat Feb 26, 2005 12:36 am
Posts: 305
http://www.weberforums.com/ftopic11632.html&highlight=

answer thread above ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron