PDA

View Full Version : Page refresh automatically after page loaded?



ismailc
01-22-2008, 02:16 PM
Hi,
I have a tooltip that is javascript but works for the first page but on next page
one has to (F5) refresh for it to work.

I thought of refreshing it automatically just one after load.

I added the following code to the body onload but the page then refreshed all the time!
[code]
"JavaScript:location.reload(true);"

where would i put this or call it automatically

Please help!

Regards

jscheuer1
01-22-2008, 07:28 PM
This really means that you have some other problem, most likely one that can be resolved without a refresh, and one, that if it can be solved some other way, should.

However, you can do:


<body onload="if(!/reloaded/.test(window.location.serach)){window.location.replace(window.location.href+'?reloaded=1');}">

This will do a one time refresh. But not if the page is later navigated to using the back button.

Further, a javascript refresh often doesn't work like a human initiated refresh, as far as the characteristics of the page go, though sometimes it does. This is the main reason why it is best to find and correct the cause of the problem, rather than try to kludge through it with a resource wasting refresh.

ismailc
01-23-2008, 08:42 AM
Hi, i had a javascript tooltip which was in an xskt file that loaded a aspx page.
so it works the first time, but when i user selects autopost which is a script in the aspx file the tooltip is lost.

I was thinking of adding it to the aspx file - which i was just informed if i change the file (all other processes are using it) other will be affected

The tooltip is javascript which is client side & aspx file the reloads scripts is server side.

So i don't really know what to do!

Maybe a javascript that executes in a vbscript to realod current page only once automatically!

Regards

jscheuer1
01-23-2008, 04:26 PM
Sounds like you are a bit confused. If I had a link to the page I might be able to figure it out. The mixture of server side and other code will make hard for me to see all of the processes involved, but I would try.

Refreshing should be avoided if at all possible.

ismailc
01-24-2008, 07:25 AM
Thank You, Thank You very, very much - i was so lost.

I found a complete CSS tooltip, so i do not need to just refresh the page first when user enter & my clientside tooltip would not work once user autopsost - so i was trying to just make it work the first time.


Lucky, Lucky Me - I found A Complete CSS Tooltip that i used in my xslt file


Thank you for your help & kindness, I'm gratefull and really appreciate it.

Thank You!!!

[CODE]

<div id="hoverText" class="main" style="background: url(../../images/template/glass/c.png); padding: 5px; position: absolute; display: none"></div>

<script type="text/javascript">
var hoverText = document.getElementById('hoverText');
function showHover(txt, e){
if(document.all){
xpos = event.clientX + document.body.scrollLeft;
ypos = event.clientY + document.body.scrollTop;
}
else{
xpos = e.pageX;
ypos = e.pageY;
}

hoverText.innerHTML = txt;
hoverText.style.left = xpos + 'px';
hoverText.style.top = ypos + 14 + 'px';
hoverText.style.display = "block";
}
function hideHover(){
hoverText.innerHTML = "";
hoverText.style.display = "none";
}
</script>

<xsl:element name="asp:image">
<xsl:attribute name='id'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
<xsl:attribute name='runat'>server</xsl:attribute>
<xsl:attribute name='imageurl'>images/help.jpg</xsl:attribute>
<xsl:attribute name='onmousemove'>showHover('<xsl:value-of select="Tooltip" />', event)</xsl:attribute>
<xsl:attribute name='onmouseout'>hideHover()</xsl:attribute>
<xsl:attribute name='class'>main</xsl:attribute>
</xsl:element>


Thank You Very Much for your time & kindness!!!

Regards