• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Inserting Javascript

New Here ,
Mar 13, 2008 Mar 13, 2008

Copy link to clipboard

Copied

Hi,
I'm trying to insert some javascript code into a RoboHelp page - just some javascript to make a link save as a favourite. Is there any trick or method in putting javascript into RoboHelp? Every time I try, I get script errors that I do not get when using with a different html editor.

I've made a menu button that when clicked will add the current page to the users favorites, but can't seem to get any javascript to work within the html editor and sometimes Robo will mess with the code inserting its own characters.

Thanks.

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 13, 2008 Mar 13, 2008

Copy link to clipboard

Copied

Hi hughbetcha,

I haven't seen RoboHelp alter code within a <SCRIPT> tag, but the WYSIWYG editor is notorious for messing with your HTML. One of the conflicts that can occur with scripts is that RoboHelp adds its own script file to every topic in order to support DHTML. It is possible, but unlikely, that you might define a constant or name a function that is already in use.

I'm confused by your statement "can't seem to get any javascript to work within the html editor," as the script won't work from the editor. You will need to compile before you test it. But I suspect you are doing that correctly.

What error messages do you get? If you compare the script that worked from one editor, to that which didn't from RH, what are the differences?

Try removing the <SCRIPT LANGUAGE="JavaScript" TITLE="BSSC Special Effects" SRC="BSSCDHTM.js"> </SCRIPT> line and also delete all the ONLOAD, etc. satements in your BODY tag in a topic (from your True Code editor - don't return to your WYSIWYG editor before compiling) and see if your custom script works in that topic. That will let you know if there is a conflict with RoboHelp's code.

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 13, 2008 Mar 13, 2008

Copy link to clipboard

Copied

Three things:

1. When entering JavaScript into TrueCode, Save All before switching to WYSIWYG mode.

2. Be very careful not to introduce line breaks within sections of the script. Usually, I filter any code I've downloaded from sites that offer them through Notepad, by pasting the code and turning off Word Wrap. That tells me exactly where the only allowable line breaks should appear, so that I can verify the format after pasting it into RH.

3. Pay special attention to where in the topic you should place the <SCRIPT call (sometimes in the <HEAD> section, sometimes after the <BODY> tag, sometimes before the </BODY> tag, etc.).


Good luck,
Leon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Thanks for the advice. I copied the code into WordPad first and then brought into Robo. This seemed to fix the problem previously where Robo was changing the code slightly. I should mention I'm using RoboHelp 7 HTML and publishing to RoboHelp 7 Server.

Again, this javascript is supposed to make an image I created a link that will open up the Favorites window promting the user to save it to their Favorites. When I preview the page, my image does not appear, but the "X" empty image when clicked does open up Favorites, so the javascript seems to work. With the image being referenced within the Javascript, in the Design view the image does not display (just get that red box indicating there is a script there).

I published the project to the server to see how it would appear, but I don't even get the empty image there so there's nothing to click on to execute the javascript. Also, when publishing was completed I noticed the image did not get published to the server, so I assume I cannot include the image within the javascript....in order for an image to be published to the server it needs to be viewable in Design view??? I can try the script without using an image as a link, but am wondering if I just need to get the image published to the server for it to work?

I've attached the javascript code I used. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

It sounds like your bookmark.JPG image is missing. Did you add it to your baggage files? Is this WebHelp? I ask because of the browser checks.

This might be irrelevant but I also noticed the upper case JPG extension. Adobe Photoshop does that to my images when I modify them and then our UNIX server (which is case sensitive) can't find them because all the file references are lower case. And Windows (which is case-insensitive) doesn't allow a direct name change from 'file.JPG' to 'file.jpg.'

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

LATEST
John brings up a good point about adding the images to the Baggage Files folder: as far as I know, RH doesn't "recognize" images that are not linked using the <img> HTML tag. Therefore, it will not "carry over" the image into the output folder unless it's told to with other means (the aforementioned Baggage Files folder).


Good luck,
Leon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp