Customer section

Forum index » JavaScript SiteSearch Generator » Select Page via Javascript

alvaro

Number of posts: 2
Rank: User

Profile of user
Response

Posted: 06.08.2012 [12:52]

Hi, I am developing a manual with your fantastic software, but I have an issue:

I need to select an specific web page (of the pages that precission generate) via JavaScript.

Is i possible? How?

Thanks a lot.

admin

Number of posts: 557
Rank: admin •••

Profile of user
Response

Posted: 07.08.2012 [23:29]

Hi,

from where is your JavaScript called?

If it is from within a web page itself, it could be designed as a simple call of

Code:
window.location.replace("topics/topic.htm")


If it is called from an external page, you should change the web help main file (index.htm) in your template (or directly in the resulting web help) as follows:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>$PROJECTTITLE</TITLE>
<script type="text/javascript" language="JavaScript">
function DoOnLoad()
{
var filename = left.location.pathname.substring(left.location.pathname.replace(/\\/gi, "\/").lastIndexOf('/')+1);
if (filename == 'wh_search.htm')
left.checkHighlight();
}

function DoMainNavigate()
{
var param = location.hash;
if (param.length != 0)
{
param=param.substring(1);
right.navigate(param);
}
}
</script>
</HEAD>
<frameset rows="27,*" framespacing="0" onload="DoMainNavigate()">
<frame name="head" scrolling="no" noresize="noresize" src="wh_head.htm" frameborder="0">
<frameset cols="25%,*" framespacing="1">
<frame name="left" src="wh_toc.htm" frameborder="0">
<frame name="right" src="$DEFTOPIC" frameborder="0" onload="DoOnLoad()">
<noframes>
Your browser does not handle frames! This feature is needed to view this WebHelp manual.
</noframes>
</frameset>
</frameset>
</HTML>


The function "DoMainNavigate()" has been added and it has been assigned to the main frameset element's onload event.
Now you can try the navigation to desired help topic by the following way:

Code:
http://www.site.com/help/index.htm#topi...


As you can see, the code uses a little trick with # (hash) part of passed url, that is parsed and the resulting topic page is navigated into the right frame.

If I misunderstood your question, please feel free to specify more details.

Kind regards,

Roman

New post to this topic

[.bold.]TEXT[./bold.]  [.italic.]TEXT[./italic.]  [.code.] TEXT [./code.]  [.quote.] TEXT [./quote.]

Number of topics: 373 • Number of posts: 1244 • Number of registered users: 62

Copyright © 2008-2021  Precision software & consulting. All rights reserved.
Send your comments to www pages.
Contact   |   RSS
Precision software & consulting
Narodnich mucedniku 447
738 01  Frydek-Mistek
Czech Republic