Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open win with delay

Status
Not open for further replies.

hablablow

Programmer
Sep 9, 2000
115
FR
Hello,
I am trying to open a delayed popup from a parent popup.
Say a page index loads. While body onload it opens a popup A.
After a delay i would like a popup B to show up.
The setTimeout i am using is mixed with another center window Js function, and this is my problem: i don't know how to proper insert the setTimeout in my center window script without having syntax script problems.
If anyone could give me a push on this below:

********** here is my center window script:*****************

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
var exwin=null;
function Warning (theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0

if(window.screen)if(isCenter)if(isCenter==&quot;true&quot;){
var myLeft = (screen.width-myWidth)/2;
var myTop = (screen.height-myHeight)/2;
features+=(features!='')?',':'';
features+=',left='+myLeft+',top='+myTop;
}
if(exwin!=null)exwin.close();
window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);

}
//-->
</SCRIPT>

********************** In my body *********************

onLoad=&quot; javascript:Warning('warning.htm','warning','','200','200','true')............

*********************The delay function*******************

setTimeout('??????????????()',40000)

With the position script and the onload it works, but where should i put the delay ??
If anyone can help.
Thanks for your incomming messages.
Hablablow

 
have you tryed just

setTimeout(&quot;Warning
('warning.htm','warning','','200','200','true')&quot;,40000) ?? Victor
 
Hi,

I tryed both solutions you are offering me but none works.
I know this is close and the answer is in the middle of it !

Victor, i tryed many ways this solution before but i always have a syntax problem
I put your code above in my onload
onLoad=&quot;setTimeout(&quot;Warning('warning.htm','warning','','200','200','true')&quot;,6000)...
Js console in netscape returns:
syntax error.

setTimeout(
..........^
and nothing happens even in Ie.
I would be glad if we could go on this way finding the trick.

Cyberwolf14 your solution opens several wrong windows.

This result should be usefull and i strangely found few things about this subject on the
net.
My problem remains because i want to mix this open with delay function with a center
popup script and that i am a little lost in Js syntax.

I appreciate your help.
If we could go on this subject.
Hablablow (.com)
 
backslash quotes, always backslash quotes when they'r einside of other quotes

several solutions:

1. onLoad=&quot;setTimeout(\&quot;Warning('warning.htm','warning','','200','200','true')\&quot;,6000)..&quot;; in the body tag

2. define your load handler inside of script tag
<script>
onload=function(){
setTimeout(&quot;Warning
('warning.htm','warning','','200','200','true')&quot;,6000);
//...
}
</script> Victor
 
Victor,

It...doesn't work

1) For your first option Js console in netscape replies:


illegal character.

setTimeout(...........^

2) Second option: nothing happens when you define it in a script. No errors, nothing...
Shall i call the script in the onload ?
Are we close ?
Hablablow
 
By the way it works in Ie when you put 1) + 2)...
Only netscape doesn't accept the \ character as mentioned above.

Hablablow
 
oops.. my fault.. i've mixed it all..

1. onLoad=&quot;setTimeout('Warning(\'warning.htm\',\'warning\',\'\',\'200\',\'200\',\'true\')',6000)&quot;

2. this thing works.. in nn4.5 under w98

<script>
onload=function(){
setTimeout(&quot;Warning()&quot;,6000);
//...
}
</script>
Victor
 


What shall i say ? Multi - Thanks for sure

You did it all !

I only made copy - paste and it is working now

Sincerly this is great

Ok but one last thing : why all the \\\\\\ for ?

Cya

Hablablow
 
well..

here is explanation from js regexps:

\ Marks the next character as either a special character, a literal, a backreference, or an octal escape. For example, 'n' matches the character &quot;n&quot;. '\n' matches a newline character. The sequence '\\' matches &quot;\&quot; and &quot;\(&quot; matches &quot;(&quot;. Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top