|
Delayed popup window on mouseover
10-13-2010, 02:36 PM
|
Delayed popup window on mouseover
|
Posts: 35
|
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>
|
|
|
|
10-13-2010, 07:26 PM
|
Re: Delayed popup window on mouseover
|
Posts: 52
Name: Alex
|
<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..
|
|
|
|
10-14-2010, 04:07 AM
|
Re: Delayed popup window on mouseover
|
Posts: 35
|
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
|
|
|
|
10-14-2010, 06:44 PM
|
Re: Delayed popup window on mouseover
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
10-14-2010, 07:37 PM
|
Re: Delayed popup window on mouseover
|
Posts: 52
Name: Alex
|
Rayo, listen to chrishirst 
|
|
|
|
10-15-2010, 03:29 AM
|
Re: Delayed popup window on mouseover
|
Posts: 35
|
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.
|
|
|
|
10-16-2010, 03:02 PM
|
Re: Delayed popup window on mouseover
|
Posts: 52
Name: Alex
|
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>
|
|
|
|
10-17-2010, 08:39 AM
|
Re: Delayed popup window on mouseover
|
Posts: 35
|
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
|
|
|
|
10-17-2010, 10:55 AM
|
Re: Delayed popup window on mouseover
|
Posts: 52
Name: Alex
|
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..
|
|
|
|
10-17-2010, 11:01 AM
|
Re: Delayed popup window on mouseover
|
Posts: 52
Name: Alex
|
if I need a tip, I'd used something like
<span Style="cursor:help;" title="this is a tip">?</SPAN> 
|
|
|
|
10-17-2010, 02:32 PM
|
Re: Delayed popup window on mouseover
|
Posts: 35
|
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
|
|
|
|
10-18-2010, 03:42 AM
|
Re: Delayed popup window on mouseover
|
Posts: 35
|
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
|
|
|
|
10-18-2010, 03:04 PM
|
Re: Delayed popup window on mouseover
|
Posts: 52
Name: Alex
|
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=' '; 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>';
|
|
|
|
10-19-2010, 03:12 AM
|
Re: Delayed popup window on mouseover
|
Posts: 35
|
Thank's for that Alex I'll have a play with it.
Rayo 
|
|
|
|
|
« Reply to Delayed popup window on mouseover
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|