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!

Need a Hand

Status
Not open for further replies.

DANZIG

Technical User
Mar 8, 2001
142
US
Hello

I'm not a jscript person more of a vbscript and am trying to combine two functions to work for the same event. I'm sure somebody has something like this already and will probably see what I need to do instantly.

HTML Code
Code:
<html>
<head>
<script language="javascript">

function showStatus(sMsg) 
{
window.status = sMsg ;
return true ;
}

function initalt()
{
altback="white" 
altborder="CEDEE7"
altfont="arial"  // Alt-Message Font
altfontcolor="203C70"// Alt-Message Font color
altfontsize="2" // Alt-Message Font Size
altoffx=5 // Alt-Message horizontal offset from mouse-position
altoffy=15 // Alt-Message vertical offset from mouse-position
altwidth=2 // Alt-Message width, will be expanded by your message
altheight=0 // Alt-Message height, will be expanded by your message
// end of Variables
             
                document.onmousedown = sniff
                document.onmousemove = sniff
                document.onmouseup = sniff
  if (document.layers) 
  {  //NS
  document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP)
  document.layers['altmessage'] = new Layer(altwidth)
  document.layers['altmessage'].left = 0
  document.layers['altmessage'].top = 0
  document.layers['altmessage'].height = altheight
  document.layers['altmessage'].bgColor = altback
  document.layers['altmessage'].visibility = "hidden"
  document.layers['altmessage'].borderStyle = "solid"
  document.layers['altmessage'].borderColor = altborder
  document.layers['altmessage'].borderWidth = 1
  }
  else if (document.all)
  { //IE
  document.body.insertAdjacentHTML("BeforeEnd",'<DIV ID="altmessage" STYLE="z-index:200;position:absolute;width:'+altwidth+';height:'+altheight+';left:0;top:0;visibility:hidden;background:'+altback+';border-style:solid;border-width:1;border-color:'+altborder+'"></DIV>')
  }
  }

function sniff(e) 
        {
        // GETS Mouseposition
        if (document.layers)
        {
        var mousex=e.pageX; var mousey=e.pageY;document.layers['altmessage'].left = mousex+altoffx;document.layers['altmessage'].top = mousey+altoffy
        }
        else if (document.all)
        {
        var mousex=event.x; var mousey=event.y+document.body.scrollTop;altmessage.style.top=mousey+altoffy;altmessage.style.left=mousex+altoffx
        }
        }

function doalt(message)
       {
       //The main routine
       content='<font face="'+altfont+'" size="'+altfontsize+'" color="'+altfontcolor+'">'+message+'</FONT>'				
       if (document.layers) 
       {
       with (document.layers['altmessage'].document)
       {
 		open()
       write(content)
       close()
       }
       document.layers['altmessage'].visibility = "show"
       }
       else if (document.all) 
       { window.status = ''
	    document.all['altmessage'].innerHTML = content
	    document.all['altmessage'].style.visibility = "visible"
       }
       }

function realt()
       {
       if (document.layers)document.layers['altmessage'].visibility = "hidden";
       else if (document.all) document.all['altmessage'].style.visibility = "hidden";
       }
</script>
</head>
<BODY onload="initalt()">

<a href="[URL unfurl="true"]http://www.yoursite.html"[/URL] onmouseover="doalt('your message')" onmouseout="realt()">Link</A>
</body>
</html>

I'm wanting to incorperate the the window.status ='' into the popup functions so that I'm able to visually hide the urls being processed by some of my forms. The popups are very nicely done (found them on the web) and function well as a type of user help but I need to also hide the url respnose being sent back to the server to prevent users from url'ing the database.

Any help would be appreciated.




Thanks, Danzig
 
First off, document.all and document.layers are OLD, and there are several new (non-IE) browsers out now that don't use either object. I'd recomment dropping everything for document.layers (old Netscape) and removing the references to document.all. You'll need to use document.getElementById(name of your id) in place of the document.all where you reference styles. If you don't do this, I'd say a good 25% of the visitors to your site won't see what you're trying to do there.

As for the status line, in your doalt() function add a line:

window.status='';

Lee
 
I don't really know jscript quite well enough to re-tool the whole thing. I have tried adding the window.status=''; to about every section of the mouse over event and it still displays the url in the status window. Am I adding it in the worng places?


Thanks, Danzig
 
Here it is. I've added the window.status ='' ; to about every part of the doalt() function. What I'm needing is to completely hide the urls at all times. I would be using this in a framed page so they do not show in the address bar now but the hyperlinks do show at the moment in the window status bar. I'm writing an intranet solution in a pure Microsoft shop so if this works on mine it will work on all.

Code:
<html>
<head>
<script language="javascript">

function initalt()
{
altback="white" 
altborder="CEDEE7"
altfont="arial"  // Alt-Message Font
altfontcolor="203C70"// Alt-Message Font color
altfontsize="2" // Alt-Message Font Size
altoffx=5 // Alt-Message horizontal offset from mouse-position
altoffy=15 // Alt-Message vertical offset from mouse-position
altwidth=200 // Alt-Message width, will be expanded by your message
altheight=0 // Alt-Message height, will be expanded by your message
// end of Variables
             
                document.onmousedown = sniff
                document.onmousemove = sniff
                document.onmouseup = sniff
  if (document.layers) 
  {  //NS
  document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP)
  document.layers['altmessage'] = new Layer(altwidth)
  document.layers['altmessage'].left = 0
  document.layers['altmessage'].top = 0
  document.layers['altmessage'].height = altheight
  document.layers['altmessage'].bgColor = altback
  document.layers['altmessage'].visibility = "hidden"
  document.layers['altmessage'].borderStyle = "solid"
  document.layers['altmessage'].borderColor = altborder
  document.layers['altmessage'].borderWidth = 1
  }
  else if (document.all)
  { //IE
  document.body.insertAdjacentHTML("BeforeEnd",'<DIV ID="altmessage" STYLE="z-index:200;position:absolute;width:'+altwidth+';height:'+altheight+';left:0;top:0;visibility:hidden;background:'+altback+';border-style:solid;border-width:1;border-color:'+altborder+'"></DIV>')
  }
  }

function sniff(e) 
        {
        // GETS Mouseposition
        if (document.layers)
        {
        var mousex=e.pageX; var mousey=e.pageY;document.layers['altmessage'].left = mousex+altoffx;document.layers['altmessage'].top = mousey+altoffy
        }
        else if (document.all)
        {
        var mousex=event.x; var mousey=event.y+document.body.scrollTop;altmessage.style.top=mousey+altoffy;altmessage.style.left=mousex+altoffx
        }
        }

function doalt(message)
       {window.status = '' ;
       //The main routine
       content='<font face="'+altfont+'" size="'+altfontsize+'" color="'+altfontcolor+'">'+message+'</FONT>'				
       if (document.layers) 
       {window.status = '' ;
       with (document.layers['altmessage'].document)
       {window.status = '' ;
 		open()
       write(content)
       close()
       }
       window.status = '' ;
       document.layers['altmessage'].visibility = "show"
       }
       else if (document.all) 
       { window.status = ''
	    document.all['altmessage'].innerHTML = content
	    document.all['altmessage'].style.visibility = "visible"
       }window.status = '' ;
       }

function realt()
       {
       if (document.layers)document.layers['altmessage'].visibility = "hidden";
       else if (document.all) document.all['altmessage'].style.visibility = "hidden";
       }
</script>
</head>
<BODY onload="initalt()">

<a href="[URL unfurl="true"]http://www.yoursite.html"[/URL] onmouseover="doalt('Popup text')" onmouseout="realt()">Link</A>
</body>
</html>

Thanks again


Thanks, Danzig
 
Maybe this will help:

MSDN said:
defaultStatus

For a window, reflects the default message displayed in the status bar at the bottom of the window.

Do not confuse defaultStatus with status. The status property reflects a priority or transient message in the status bar, such as the message that appears when an onmouseover event occurs over an anchor.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Well if I set the window.defaultstatus = '' in the BODY onload="initalt()" function that sets the status bar to null until the onmouseover="doalt('Popup text')" event fires then the status still changes to the url link in the <a href > tag.

Any ideas?


Thanks, Danzig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top