Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > HELP! Page.RegisterStartupScript not working right in firefox

Reply
Thread Tools

HELP! Page.RegisterStartupScript not working right in firefox

 
 
Dav
Guest
Posts: n/a
 
      12-21-2006
In my ASP.NET codebehind I have the following code to jump to a certain
section of the page:

---
Dim strAnchorScript As String = "<script language='javascript'>" & _
"window.location.hash='#" & strLink & "'</script>"

Page.RegisterStartupScript("anchorScript", strAnchorScript
---

In IE when it loads the page it jumps to a certain section of the page.
For firefox it just loads the page. But if I refresh the page in
firefox it jumps to the the section I want.

So, how do I get this to work in firefox (to use
Page.RegisterStartupScript and to jump to a certain place on the page)?
This seems like the easiest way to jump to a certian page.

Please post your answer here (no emails) and no flames.

Thanks for you help!

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      12-21-2006
Hi,
I suspect there are some probematic characters in strLink.Try
escape(strLink) and see if it is working or not.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

"Dav" wrote:

> In my ASP.NET codebehind I have the following code to jump to a certain
> section of the page:
>
> ---
> Dim strAnchorScript As String = "<script language='javascript'>" & _
> "window.location.hash='#" & strLink & "'</script>"
>
> Page.RegisterStartupScript("anchorScript", strAnchorScript
> ---
>
> In IE when it loads the page it jumps to a certain section of the page.
> For firefox it just loads the page. But if I refresh the page in
> firefox it jumps to the the section I want.
>
> So, how do I get this to work in firefox (to use
> Page.RegisterStartupScript and to jump to a certain place on the page)?
> This seems like the easiest way to jump to a certian page.
>
> Please post your answer here (no emails) and no flames.
>
> Thanks for you help!
>
>

 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      12-21-2006
"Dav" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...

> In my ASP.NET codebehind I have the following code to jump to a certain
> section of the page:
> Dim strAnchorScript As String = "<script language='javascript'>" & _
> "window.location.hash='#" & strLink & "'</script>"
>
> Page.RegisterStartupScript("anchorScript", strAnchorScript


Well, the first thing to do is to eliminate your outdated non
XHTML-compliant script declaration:

"<script language='javascript'>"

is deprecated in favour of:

"<script type='text/javascript'>"

I'm not saying that will definitely solve it but, when things work in IE and
not in other browsers, it's almost always because of IE's non-standard
behaviour.

> In IE when it loads the page it jumps to a certain section of the page.
> For firefox it just loads the page. But if I refresh the page in
> firefox it jumps to the the section I want.


Second thing to do is to examine the source in IE and FireFox - what's
different...?

> So, how do I get this to work in firefox (to use
> Page.RegisterStartupScript and to jump to a certain place on the page)?
> This seems like the easiest way to jump to a certian page.


Yes, it certainly should work. However, might it be that it doesn't work in
FireFox the first time because of script placement? I.e. is FireFox trying
to run the code too early, before the whole page has been completely built?
See here:
http://www.experts-exchange.com/Web/..._21622556.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Menu Items is not right aligned with Right to Left documen =?Utf-8?B?QmlzaG95?= ASP .Net 0 12-28-2006 11:39 AM
Absolute position on the right not working in FireFox fishinsanluis@yahoo.com HTML 3 01-07-2006 09:42 PM
Tool to enable Right click on pages where Right click is disabled tsteinke@gmail.com Computer Support 4 08-28-2005 11:53 PM
Tool to right click image in windows explorer and rotate image right or left 90 degrees siliconpi Digital Photography 2 11-29-2004 12:56 PM
pass the right form input to the right control Tom ASP .Net 0 12-11-2003 03:07 AM



Advertisments