JavaScript issue in mojoPortal

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/3/2011 1:26:46 PM
Gravatar
Total Posts 8

JavaScript issue in mojoPortal

Hello,

I've created a website using mojoPortal and I would like to include a custom made Image Accordion control within the Master Page. However, in order for my control to work, I need to point to a JavaScript file that I have included in the project - within the JavaScript file itself I am referencing three images.

The reason the Accordion isn't working is because these images need the "runat=server" tag in order for them to be displayed. I've tested this by simply putting an image on the page like this <img src="images/test1.jpg"> (which doesn't work). However, if I add the "runat=server" tag like this <img src="images/test2.jpg" runat="server">, the image successfully displays.

Unfortunately, this doesn't work by me adding the "runat=server" tag within the JavaScript, because as far as I am aware, JavaScript is client-side script whereas the "runat=server" tag only functions for server-side script.

Does anyone know any workarounds or do I have to rethink my custom made Image Accordion control?

Many thanks

Rick

5/3/2011 1:36:38 PM
Gravatar
Total Posts 18439

Re: JavaScript issue in mojoPortal

You don't need runat="server" you just need to use the full relative path for the image relative to the root of the site, where the first / represents the root of your site like this:

<img src='/Data/images/myimage.png' />

so in this example the /Data folder is directly below the root of the site.

Hope that helps,

Joe

5/3/2011 2:13:31 PM
Gravatar
Total Posts 8

Re: JavaScript issue in mojoPortal

Joe,

This is brilliant - works a charm!

Thank you for your quick response and help!

Rick

5/3/2011 2:28:55 PM
Gravatar
Total Posts 8

Re: JavaScript issue in mojoPortal

Hi,

I spoke too soon!

As I am declaring these images in the JavaScript file - whilst it works for any pages at the root of the website, any page in a sub-folder (such as the login page "Secure/Login.aspx") results in a broken image as it is picking up the full relative path to the image.

5/5/2011 11:28:21 AM
Gravatar
Total Posts 18439

Re: JavaScript issue in mojoPortal

images with urls relative to the root of the site can work on any page no matter whether it is in a folder like /Secure or not. If it is not working then your javascript is doing something to change the url, maybe it is expecting an url relative to the javascript file.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.