PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Please answer some JavaScript programming questions:

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> Java Script / AJAX
View previous topic :: View next topic  
Author Message
Leonidasphp



Joined: 25 Feb 2005
Posts: 236

PostPosted: Mon Jan 21, 2008 10:09 pm    Post subject: Please answer some JavaScript programming questions: Reply with quote

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 ?
Back to top
View user's profile Send private message
lostboy



Joined: 02 May 2004
Posts: 5147
Location: toronto, canada

PostPosted: Tue Jan 22, 2008 10:46 pm    Post subject: Reply with quote

1. how are you tracking the visits? that will determine if JS can pop up a window

2. http://www.java2s.com/Code/JavaScript/Development/UsingdocumentwriteonAnotherWindow.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
Back to top
View user's profile Send private message Send e-mail AIM Address MSN Messenger
Leonidasphp



Joined: 25 Feb 2005
Posts: 236

PostPosted: Wed Jan 23, 2008 2:15 pm    Post subject: Reply with quote

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) ?
Back to top
View user's profile Send private message
lostboy



Joined: 02 May 2004
Posts: 5147
Location: toronto, canada

PostPosted: Thu Jan 24, 2008 4:57 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail AIM Address MSN Messenger
Leonidasphp



Joined: 25 Feb 2005
Posts: 236

PostPosted: Thu Jan 24, 2008 10:22 am    Post subject: Reply with quote

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 ?
Back to top
View user's profile Send private message
Leonidasphp



Joined: 25 Feb 2005
Posts: 236

PostPosted: Mon Feb 18, 2008 11:10 pm    Post subject: http://www.weberforums.com/ftopic11632.html&highlight= Reply with quote

http://www.weberforums.com/ftopic11632.html&highlight=

answer thread above ?
Back to top
View user's profile Send private message
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



PHP Code Examples
 Stream diffrent sizes of images from a single image to save disk space.
 JavaScript dropdown list menu to switch any page.
 Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
 PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
 Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
 Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
 A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Post new topic   Reply to topic    WeberForums.com Forum Index -> Java Script / AJAX All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum






Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum