Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » relative path reference in html?
relative path reference in html? [message #682268] Fri, 10 June 2011 18:18 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 141
Registered: July 2009
Senior Member
I have the following code in a Text control:

<div id="twisty_01" style="cursor:pointer"
onclick='if (document.getElementById("content_01").style.display == "none")
{
document.getElementById("twisty_01").innerHTML = "<img src=\"WebContent/report/images/CollapseInfoIcon.gif\" alt=\"Angry face\" />";
document.getElementById("content_01").style.display = "block";
} else {
document.getElementById("twisty_01").innerHTML = "<img src=\"WebContent/report/images/ExpandInfoIcon.gif\" alt=\"Angry face\" />";
document.getElementById("content_01").style.display = "none";
}' > <img src="WebContent/report/images/ExpandInfoIcon.gif" alt="Angry face" /> </div>
<div id="content_01" style="display:none;" >
Stuff goes here...
</div>

The issue is that the two image references in red (inside the onclick script) do not find the image at the relative path. To make these work I must put in the fully qualified path which is not desirable for obvious reasons!
The exact same relative path works fine in the last image specification (in blue).

Sorry if this is just an HTML question rather than a BIRT question but it is hard to tell how this is all being parsed and resolved under all these layers Wink

So how the heck can I find the images for the tags in red without specifying the fully qualified path?

Thanks,
Mike
(no subject) [message #682321 is a reply to message #682268] Fri, 10 June 2011 20:32 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike,

I added an image to a text element like:

<div id="testimg">
<img id="myimg"
src=<VALUE-OF>reportContext.getHttpServletRequest().getContextPath()
+"/webcontent/birt/images/Go.gif"</VALUE-OF> alt="Angry face" />
</div>

I then added a script to another text element that changed the image like:

<script>
var img = document.getElementById("myimg");
var cur = img.src;
var newsrc = cur.replace("Go.gif", "Up.gif");
img.src = newsrc;
</script>

And this worked


Jason

On 6/10/2011 2:18 PM, Mike Wulkan wrote:
> I have the following code in a Text control:
>
> <div id="twisty_01" style="cursor:pointer"
> onclick='if (document.getElementById("content_01").style.display ==
> "none") {
> document.getElementById("twisty_01").innerHTML = "<img
> src=\"WebContent/report/images/CollapseInfoIcon.gif\" alt=\"Angry face\"
> />";
> document.getElementById("content_01").style.display = "block";
> } else {
> document.getElementById("twisty_01").innerHTML = "<img
> src=\"WebContent/report/images/ExpandInfoIcon.gif\" alt=\"Angry face\" />";
> document.getElementById("content_01").style.display = "none";
> }' > <img src="WebContent/report/images/ExpandInfoIcon.gif" alt="Angry
> face" /> </div>
> <div id="content_01" style="display:none;" >
> Stuff goes here...
> </div>
>
> The issue is that the two image references in red (inside the onclick
> script) do not find the image at the relative path. To make these work I
> must put in the fully qualified path which is not desirable for obvious
> reasons!
> The exact same relative path works fine in the last image specification
> (in blue).
>
> Sorry if this is just an HTML question rather than a BIRT question but
> it is hard to tell how this is all being parsed and resolved under all
> these layers ;)
>
> So how the heck can I find the images for the tags in red without
> specifying the fully qualified path?
>
> Thanks,
> Mike
Previous Topic:Hour and Minutes formating
Next Topic:Embedded Report - JavaScript Error
Goto Forum:
  


Current Time: Fri Nov 21 10:55:30 GMT 2014

Powered by FUDForum. Page generated in 0.02393 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software