Skip to main content
Known Participant
Oct 21, 2009 12:13 AM UTC
Answered

Baby steps - combining Javascript and HTML in RH7

Help, please!

I know nothing about HTML programming, and I have several small links I would like to use with Javascript code.

This is one link for the user to click on:

<p style="font-size: 8pt; text-align: center;" align=center>Print this
page</td>

I have this little piece of Javascript:

<a href="javascript:window.print()">Print this page</a>

How do I put the two together?

I don't have time to learn HTML - I need to get this working by tomorrow!

Thanks for any help...

This topic is closed to new replies. Start a new post to keep the conversation going.
RoboWizard
RoboWizardCorrect answer
Inspiring
Oct 21, 2009 3:55 AM UTC

Hi there

Interesting that you say you don't know anything about HTML or JavaScript, then post the HTML code and the JavaScript code!

I suppose if you want to do it the HTML way, the new code would look something like this:

<p style="font-size: 8pt; text-align: center;" align=center><a href="javascript:window.print()">Print this page</a></td>

However, you should be able to just select the text in the WYSIWYG or Design view and act as if you are linking to another topic. In the Hyperlink dialog you would type javascript:window.print();

Hopefully this was helpful... Rick

Helpful and Handy Links

RoboHelp Wish Form/Bug Reporting Form

Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!

Adobe Certified RoboHelp HTML Training

SorcerStone Blog

RoboHelp eBooks

7 replies

Known Participant
Oct 21, 2009 9:21 PM UTC

I'm confused again.

We found some Javascript code that does what we need in another area - buttons to print the current page, and open a window of a specific size, with no scrollbars, etc.

However, when we tried to add that code, RH kept rewriting it, putting in quotes, etc., then rejecting it for having errors.

I found the insert script option, which doesn't rewrite the code, but now can't figure out (or find out online - I looked, really!) how to associate that script with a link the user can click on.  All I get is the little red box.

Can anyone help?  Please?

Translate
RoboWizard
RoboWizardCorrect answer
Inspiring
Oct 21, 2009 3:55 AM UTC

Hi there

Interesting that you say you don't know anything about HTML or JavaScript, then post the HTML code and the JavaScript code!

I suppose if you want to do it the HTML way, the new code would look something like this:

<p style="font-size: 8pt; text-align: center;" align=center><a href="javascript:window.print()">Print this page</a></td>

However, you should be able to just select the text in the WYSIWYG or Design view and act as if you are linking to another topic. In the Hyperlink dialog you would type javascript:window.print();

Hopefully this was helpful... Rick

Helpful and Handy Links

RoboHelp Wish Form/Bug Reporting Form

Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!

Adobe Certified RoboHelp HTML Training

SorcerStone Blog

RoboHelp eBooks

Translate
Known Participant
Oct 21, 2009 12:14 PM UTC

Very helpful, Rick, thank you!

I got the HTML code by going to the HTML view instead of the design view, and found the Javascript code on the Internet.

So, for another more complex one (also from the Internet), could I put it in a snippet and link to that in the hyperlink dialog?

Marion

Translate
RoboColum_n_
Legend
Oct 21, 2009 12:49 PM UTC

Hi Marion.

Unfortunately snippets are not designed to work that way and you can't link to them. You may want to explore a macro solution. There are several around but I prefer Macro Express.


Read the RoboColum(n) for a tips, tricks and musings on the Technical Communication Suite products.

Translate