| View previous topic :: View next topic |
| Author |
Message |
Leonidasphp
Joined: 25 Feb 2005 Posts: 305
|
Posted: Mon Jan 21, 2008 10:09 pm Post subject: Please answer some JavaScript programming questions: |
|
|
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 |
|
 |
lostboy

Joined: 02 May 2004 Posts: 5573 Location: toronto, canada
|
|
| Back to top |
|
 |
Leonidasphp
Joined: 25 Feb 2005 Posts: 305
|
Posted: Wed Jan 23, 2008 2:15 pm Post subject: |
|
|
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 |
|
 |
lostboy

Joined: 02 May 2004 Posts: 5573 Location: toronto, canada
|
Posted: Thu Jan 24, 2008 4:57 am Post subject: |
|
|
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 |
|
 |
Leonidasphp
Joined: 25 Feb 2005 Posts: 305
|
Posted: Thu Jan 24, 2008 10:22 am Post subject: |
|
|
| 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 |
|
 |
Leonidasphp
Joined: 25 Feb 2005 Posts: 305
|
|
| Back to top |
|
 |
|