I’ve created some html and loaded it into an htmlviewer but I don’t necessarily want the viewer to display at the top of the page. Is there a way to have the viewer open at or scroll to an anchor in the html?
But in what context could you tell the htmlviewer to access that url as the actual html isn’t in some file to be linked to?
If you have placed an anchor named anchor1 by placing this code in your page
The correct way to load it in the HTMLViewer for it to display starting on top with the anchor is by calling it’s URL with #anchor1 :
HTMLViewer.url = "http://mydomain.com/mypage.html#anchor1
The HTMLViewer will automatically place the page at the anchor. Any browser will do too.
HTMLViewer.url = HTMLViewer.url+"#anchor1"
There is no mypage.html to link to. The html is a string variable used with loadpage(). I suppose I could try the added step of writing the string to a file and linking to it.
And I missed your alternative of adding to the url after it has loaded. That sort of works but I think it puts me in the right direction. Thanks.
If you are using loadpage, why not create several sections in your HTML string ?
My page is essentially a list of dates and I just needed one anchor so that the current date appeared at the top but also allowing the user to scroll up to past dates if they desired.