Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Delayed popup window on mouseover
Old 10-13-2010, 02:36 PM Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Hi everyone....can anyone help with this mouseover popup window script.
I've been trying to add a delay to the opening of the window on mouseover but cant get it to work, neither with inline handlers or in the head script.
Any suggestions most welcome.
Here's the script:

<SCRIPT LANGUAGE=JavaScript1.2>
function winopen(e,linkid)
{if(document.all)
{leftpos=event.screenX;toppos=event.screenY;}
if(document.layers||document.getElementById)
{leftpos=e.screenX;toppos=e.screenY;}
toppos=toppos+10
MessageWin=eval('window.open(linkid,"newwin",confi g="width=300,height=200,location=no,status=no,dire ctories=no,toolbar=no,scrollbars=no,menubar=no,res izable=no,top='+toppos+',left='+leftpos+'")');
MessageWin.focus()}
</SCRIPT>

<a href="#" onMouseOver="winopen(event,'test.txt')" onMouseOut="MessageWin.close()" onClick="window.open('http://.somesite.com');">Mouseover Open/Close Window, Click Go To url</a>
Rayo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-13-2010, 07:26 PM Re: Delayed popup window on mouseover
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
<a href="#" onMouseOver="winopen(event,'test.txt')" onMouseOut="MessageWin.close()" onClick="setTimeout('window.open(\'http://.somesite.com\');',5000);">Mouseover Open/Close Window, Click Go To url</a>

Last edited by elf2002; 10-13-2010 at 07:27 PM..
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-14-2010, 04:07 AM Re: Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thank's for your help elf2002.

This inline handler works ok with the onclick event, but I am trying to create a delay for the onmouseover winopen event, an inline method or in the head script.
Cheers
Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-14-2010, 06:44 PM Re: Delayed popup window on mouseover
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
just put the setTimeOut in the onMouseOver event just as it is in the onClick
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-14-2010, 07:37 PM Re: Delayed popup window on mouseover
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
Rayo, listen to chrishirst
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2010, 03:29 AM Re: Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thanks for your tip chrishirst but I already tried that with a few tweaks but couldn't get it to work properly, this is as far as I got:

<a href="#" onMouseOver="setTimeout('winopen(\'event\',\'test. txt\');',1000);" onMouseOut="MessageWin.close()" onClick="window.open('http://somesite.com');">Mouseover Open/Close Window, Click Go To url</a>

This delays the popup ok but the window position is incorrect because parameters in the head (winopen / event) are being ignored.
I've tweaked the syntax but haven't hit the solution yet.
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-16-2010, 03:02 PM Re: Delayed popup window on mouseover
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
try
<a href="#" onMouseOver="setTimeout('winopen(event,\'test. txt\');',1000);" onMouseOut="MessageWin.close()" onClick="window.open('http://somesite.com');">Mouseover Open/Close Window, Click Go To url</a>

or

<a href="#" onMouseOver="setTimeout('winopen('+event+',\'test. txt\');',1000);" onMouseOut="MessageWin.close()" onClick="window.open('http://somesite.com');">Mouseover Open/Close Window, Click Go To url</a>
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-17-2010, 08:39 AM Re: Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thank's for your help Alex but nope.....no popup at all with these two.
I was just thinking, is there a way to show the contents of a .txt file in a javascript / CSS popup window.
Example of the page script which calls the popup:

<a href="http://somesite.com" class="tooltip" title="text file data called here">Mouseover text here</a>
or
<a href="index.htm" onmouseover="Tip('text file data called here')" onmouseout="UnTip()">Mousover text here</a>

Just wondering because I have some nice java based css scripts.

Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-17-2010, 10:55 AM Re: Delayed popup window on mouseover
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
I tried this
<SCRIPT LANGUAGE=JavaScript1.2>
function The_Window(){
TheWindow=window.open('http://somefile','Win','left=20,top=20,width=500,height=5 00,toolbar=1,resizable=1'); TheWindow.focus();
}
</SCRIPT>
<a href="#" onMouseOver="setTimeout('The_Window()',1000);" onMouseOut="MessageWin.close()" onClick="window.open('http://somesite.com');">Mouseover Open/Close Window, Click Go To url</a>

---------

heights and offsets you can determine by adding them into the body of The_Window() function

but if you want only tips, you should use floating div instead of new window

Last edited by elf2002; 10-17-2010 at 10:58 AM..
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-17-2010, 11:01 AM Re: Delayed popup window on mouseover
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
if I need a tip, I'd used something like
<span Style="cursor:help;" title="this is a tip">?</SPAN>
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-17-2010, 02:32 PM Re: Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thank's again for your input Alex, I'll try the script you suggested.
What I'm trying to do is create a mouseover popup window to display the contents of a text file which would be updated periodicaly.
Because there will be a number of these files to update, a text file would be quicker and more convenient than continuously having to re-edit a html page,
you know, just re-edit the text files and upload them to the server.

Cheer's
Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-18-2010, 03:42 AM Re: Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Hello Folks....Alex... I tried your mouseover script and yes it it works fine, so thank's for that but for this application with multiple text files it would need tweaking with arrays etc.
My intention was to call the file from the inline page link for simplicity rather than stacking them in the head script, also in the script I was working on, the popup window which is fairly small, opens up wherever the mouseover is on the page.
saraOK.....I looked at the link but I can't see the connection between that page and what I am trying to do.....thanks anyway.

Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
Old 10-18-2010, 03:04 PM Re: Delayed popup window on mouseover
Skilled Talker

Posts: 52
Name: Alex
Trades: 0
Ok.
Here is part of my old script that works very much as you need. Hope you can tune it up for you project

<script language="JavaScript">
function SClose(ZId){
Obj=document.getElementById('IdZauv'+ZId);
Obj1=document.getElementById('IdZauvTxtArea');
Obj.value=Obj1.value;
Obj=document.getElementById('layer1');
Obj.innerHTML='';
Obj.style.width=0; Obj.style.height=0;
Obj=document.getElementById('layer2');
Obj.style.background='none';
Obj.style.width=0; Obj.style.height=0;
Obj=document.getElementById('IdBtn'+ZId);
Obj1=document.getElementById('IdZauv'+ZId);
if (Obj1.value!==''){
Obj.style.background='red';
Obj.style.color='white';
}else{
Obj.style.background='#BBBBBB';
Obj.style.color='black';
}

}


function SemLayer(Name,Txt){
var IE = document.all?true:false;
Obj=document.getElementById('layer3');
if (IE){
Obj.style.left=(event.clientX + document.body.scrollLeft-100)+'px';
Obj.style.top=(event.clientY + document.body.scrollTop)+15+'px';
}else{
Obj.style.left=(parseInt(document.Show.MouseX.valu e)-100)+'px';
Obj.style.top=(parseInt(document.Show.MouseY.value )+15)+'px';
Obj.title=Obj.style.top;
}

Obj.innerHTML='<Iframe Src='+Name+'>';
}


function SemClose(){
Obj=document.getElementById('layer3');
Obj.innerHTML='';
Obj.style.width=0; Obj.style.height=0;
Obj.style.background='none';
}

</script>



<form name="Show">
<input type=hidden name="MouseX" value="0">
<input type=hidden name="MouseY" value="0">
</form>


<script language="JavaScript1.2">
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else { // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}
document.Show.MouseX.value = tempX;
document.Show.MouseY.value = tempY;
return true;
}

</script>



Echo '<Img Src=ArrR.gif Width=15 Height=15 HSpace=5 VSpace=0 Border=0 Title="" Style="cursor: hand" OnClick="if(PupilLogId',HTMLSpecialChars($CInf[$C][1]),'.innerHTML==''){this.src='',$DocRoot,'/ArrD.gif'; PupilLogId',HTMLSpecialChars($CInf[$C][1]),'.innerHTML='&nbsp;'; SemLayer('',HTMLSpecialChars($CInf[$C][0]),'','',GetPupilInfo($CInf[$C][1],$Id,$Class, $PredmetName),'');}else{this.src='',$DocRoot,'/ArrR.gif';PupilLogId',HTMLSpecialChars($CInf[$C][1]),'.innerHTML='';SemClose();}"><B id=PupilLogId',HTMLSpecialChars($CInf[$C][1]),'></B>';
elf2002 is offline
Reply With Quote
View Public Profile
 
Old 10-19-2010, 03:12 AM Re: Delayed popup window on mouseover
Rayo's Avatar
Experienced Talker

Posts: 35
Trades: 0
Thank's for that Alex I'll have a play with it.

Rayo
Rayo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Delayed popup window on mouseover
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46429 seconds with 12 queries