The Insert Image dialog has two optional fields for Picture ID: and HTML Class:. An ID you enter here will be exported as the id="your_id" attribute for the image's <img> tag in HTML-based output formats, and the HTML class is exported as the class="your_class" attribute.
Tip: You can enter multiple class names separated by spaces in the HTML Class: field if you need more than one class for the image.
You will not need these features for normal graphics but they are sometimes useful. For example, if you are planning to manipulate your graphics with your own CSS or JavaScript code.
Creating auto-incrementing IDs for cloned copies of images
In HTML an ID always has to be unique, you should never have more than one object on the same page with the same ID. This can be a problem if you are cloning copies of a ready-made image. You can get around this by creating an automatically-incrementing ID with text variables.
You can't mix text and variables in topic IDs so you need to create two variables to do this.
1.Go to and create two text variables, one for the static part of the ID and one for the incrementing number. The static part can have any name you like, the incrementing number must have two plus characters at the end of its name, for example IMAGENO++.
2.Let's say the two variables are IMAGEID and IMAGENO++. Now enter any text you like as the text for the IMAGEID variable, for example myimage_, and a 0 (the number zero) as the text for the IMAGEENO++ variable, like this (this example shows similar variables for use in tables):
3. Then instead of an ID, type in both variables in the Picture ID: field in the Insert Image dialog (or double-click on an image that has already been inserted), like this:
<%IMAGEID%><%IMAGENO++%>
Then every time you make a copy of the image in your project a new unique ID will be generated automatically. The first will be myimage_1, the second will be myimage_2 and so on.
|