rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: jerome on June 18, 2008, 09:18:25 PM

Title: How to enable a floating search button in the template ?
Post by: jerome on June 18, 2008, 09:18:25 PM
hello, ciao tutti !

i try to enable a floating search button in HFS but the javascript i use is not working in the template.
if someone have a working solution it should be appreciated.

i found a simple code on
http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm (http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm)
working in a HTML page hosted on HFS but not in the HFS template directly.


the custom script... with an alternative search function.
Code: [Select]
<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<table  width="200"   bgcolor="transparent">
<FORM name=form1  target=_parent  action=/?search= ><input name="search" type="text" style="POSITION: relative; TOP: 0px; LEFT:0px; width:90px; height:20px; z-index:2"><input class=button input name="form1" type="submit" value="search" style="POSITION: relative; TOP: 1px; LEFT:0px; width:60px;  height:22px; z-index:2"></FORM><FORM name=user><input name="user" type="hidden" value="%user%"></FORM>

</table>
<!--END OF EDIT-->

</layer>


<script type="text/javascript">



//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 10,
startY = 100;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.top=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>

the floating search example... hosted on HFS, the input class= button  works in this case
http://82.239.5.248/test-floating-search-button.html (http://82.239.5.248/test-floating-search-button.html)

the search button alone can be placed in the template, (even if it give a input class= button error)
it enable to search on all the server from any folder, sub folder and the root.
the search result is very fast when you are not logged in, and a bit slow when you are logged,
it need sometime a mouse over on a frame or a text zone to debug the to long result.

Code: [Select]
{.if| {.get|can recur.} |
<td width='70%'>
<FORM name=form1  target=_parent  action=/?search= ><input name="search" type="text" style="POSITION: absolute; TOP: 16px; LEFT:14px; width:90px; height:19px; z-index:2"><input class=button input name="form1" type="submit" value="search" style="POSITION: absolute; TOP: 16px; LEFT:110px; width:60px;  z-index:2"></FORM>
<FORM name=user><input name="user" type="hidden" value="%user%"></FORM>

</div>
/if.}

the input class= button in the template don't give the same graphical result  ??? but it works,
the input hidden user is necessary to keep the user login in the search result,
i would like to make it floating but the template say no.

if anybody have an other simple javascript compatible? or something working better?
thank you.