way to set background image static and it doesnt load after each postback?

B

Bogosian

Hi to all.I have to solve the following problem.I have to make a
website which will be a web cache machine with the look of a real
cache machine - screen and buttons below it.So i plan the background
to be an image and when users cklick the buttons only some of the data
on the screen will change.I want to make this background image
static(including the buttons if possible because otherwise it'll be
very ugly if the buttons leave blank spaces after postback).I mean
that it shouldn be loaded after each postback(no matter whether from
the cache or downloaded from the server).What i really need is just a
small portion of information to be loaded after each postback
event.What would you advice me to do - IFrames + client scripts or
something else?
Thanks in advance.
 
C

Chris Jackson

It depends on how much your content is going to change. If you are going to
be loading entire pages, then the easiest way is to use IFrames. If you
aren't changing much, then you might consider using client-side scripts to
fetch the content from a web service and then inject into the InnerHtml of
whatever section you want to populate. Caution here, however, as this is a
very brittle approach: if scripts are disabled your application will break,
and if you are doing XML manipulation on the client you will find
differences in support among the various browsers.
 
B

Bogosian

Thanks for paying attention Chris.The idea with the InnerHtml sounds
good because there are just 5 fields on the page which will change
when the user interacts with the cache machine.Could you tell me more
about this idea.More specifically is there a way to get all the data
in only one request to the server and separate it on the client
machine because all the information for the five fields is related and
can be calculated in one and the same portion of code and returned in
one response.Can you recall any places on the Internet where i can
read more about client-side scripts(i've only dealt with jscript a
little) and interacting with web seervices?
 
B

Bogosian

I forgot to mention that i want some of these fields to contain jpeg
images - so is there a way the web service return 3-4 images to the
script which are afterwards displayed on the page?
 
C

Chris Jackson

For fetching 5 text fields, that's easy to do in one hit. You can grab a
single XML document that holds all five fields as five XML elements. You can
parse this on the client using the XML handling capabilities of the
platform. Here it gets a bit tricky, because I only know of ways to support
this in IE 4.01+ and Netscape 6.0+, so if you have to support Netscape 4 or
IE 3, you will have problems. Just create an object of type DOMDocument (I
typically iterate through MSXML2.DOMDocument.4.0, MSXML2.DOMDocument.3.0,
MSXML2.DOMDocument, MSXML.DOMDocument, and Microsoft.XmlDom until I get a
successful object creation) for IE. For Netscape/Mozilla, it is
document.implementation.createDocument(...). You can do this asynchronously
by setting the onreadystatechange (IE) or onload (Netscape) property of this
object, and then in your async return handler just use XML functions to get
that data (for example, getElementsByTagName) and then pump it into the
innerHTML property.

As for places to learn, I picked up most of my JavaScript from SDK docs and
one of the O'Reilly books (whose name I can't recall, as it's on my
bookshelf at home) so others probably have better recommendations in this
regard.

Finally, regarding images, you can always set up an aspx site whose return
type is the image type that you want, and then pass back images dynamically
based on whatever criteria you are using to select them. Alternately, you
can store the direct link to the images, and then hit them. If you want a
single traversal, you may want to just have an HTML page containing all 5
fields (in tags with a unique ID) and the images you need, which you can
then fetch using XMLHTTP and then parse using the DHTML DOM.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top