Ask a Question related to ASP.NET General, Design and Development.
-
John #1
Loading images for use on client
Hi all,
I'm having a problem loading images for later use in javascript on the
client. In my code-behind, I'm using a stringbuilder object to build and
populate a few javascript variables like : js.append("var myjsvariable = New
Image")
js.append("myjsvariable.src = " & "http://localhost/images" & "myimage.jpg")
In one of my javascript functions, I reference this image and it is null.
What am I doing wrong here?
Regards
John.
John Guest
-
Loading Images
Hi, I'm very new to Flash so please give me a break.... I want to load an image dynamically into a component using loadMovie theImage._width... -
[FMX] Loading images
I have the following problem: On a on(release) event of a thumbnail the movie has to load an jpg which is in a map on website (pics). I have... -
images and loading
hey, I am making a website (in flash) and i am animating a logo at the start, I have made the logo as a gif (It doesnt loose much quality). But i... -
Loading client-side images for use in Javascript
Ok, I'll play the dumb guy.... if your script is running on the server under the testapp application, why isn't the source 'Images/down.gif' (Path... -
images not loading
I've created a portfolio that works great when I create a regular Projector. But when I try to publish it and view the Shockwave file in a browser... -
S. Justin Gengo #2
Re: Loading images for use on client
John,
Are you then placing the string you've built in the client side code?
I don't know which object you're trying to attach the javascript to, but it
sounds like you are building the string on the server side but never placing
the built string out on the client.
For example if I want to add an attribute to a textbox I could build the
string, but I then have to add the attribute to the client side code:
Dim CodeBuilt As New System.Text.StringBuilder
CodeBuilt.Append("MyStringHere")
TextBox1.Attributes.Add("onClick", "javascript:" & CodeBuilt & ";")
I'm assuming you will need to add your images to a script block so you might
want to look into the Page.RegisterClientScriptBlock method.
(Don't see RegisterClientScriptBlock in your intellisense? In .Net advanced
members are hidden by default. To make them visible: Click Tools-Options,
hen Select the "Text Editor" folder, then select the "All Languages" folder
and you will see a grayed out check box "Hide advanced members" Click the
checkbox to clear it. Alternatively you can select each language's specific
folder and turn off the Hide advanced members feature per language.)
I hope this helps.
Justin
"John" <a@b.com> wrote in message
news:eEhcbpsSDHA.2252@TK2MSFTNGP12.phx.gbl...New> Hi all,
>
> I'm having a problem loading images for later use in javascript on the
> client. In my code-behind, I'm using a stringbuilder object to build and
> populate a few javascript variables like : js.append("var myjsvariable ="myimage.jpg")> Image")
>
> js.append("myjsvariable.src = " & "http://localhost/images" &>
> In one of my javascript functions, I reference this image and it is null.
>
>
> What am I doing wrong here?
>
> Regards
> John.
>
>
S. Justin Gengo Guest
-
Vidar Petursson #3
Re: Loading images for use on client
Hi
Basic Preloader:
<script>
iPreload(// Add images to preload here
"myImg1.gif",
"myImg2.gif"
);
var imgArr = new Array();
function iPreload(){
var p = "IMAGEPATH/";
if( document.images )
{
for( i = 0; i < iPreload.arguments.length; i++ )
{
imgArr[ i ] = new Image();
imgArr[ i ].src = p + iPreload.arguments[i];
}
}
}
</script>
So if you want to set the src of a image to myImg1.gif
document.images["IMAGENAME"].src = imgArr[0];
document.images["IMAGENAME"].src = imgArr[1]; // myImg2.gif here
--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"John" <a@b.com> wrote in message
news:eEhcbpsSDHA.2252@TK2MSFTNGP12.phx.gbl...New> Hi all,
>
> I'm having a problem loading images for later use in javascript on the
> client. In my code-behind, I'm using a stringbuilder object to build and
> populate a few javascript variables like : js.append("var myjsvariable ="myimage.jpg")> Image")
>
> js.append("myjsvariable.src = " & "http://localhost/images" &>
> In one of my javascript functions, I reference this image and it is null.
>
>
> What am I doing wrong here?
>
> Regards
> John.
>
>
Vidar Petursson Guest



Reply With Quote

