[thelist] DHTML questions...

JTocher janice at discoverysystems.com
Thu Nov 15 09:30:33 CST 2001


Thanks for the responses! Yikes, sounding like what I had originally thought
to be a fairly standard process is more than I had ever imagined.

The reason for wanting to use javascript to update the location of the box
is that the final project has ~75 sites that need to be identified with the
locator box (with potentially more to be added as time goes). My goal was to
create a template that can be updated by my client as new sites are added.

Chris' recommendation regarding hard-coding the div tag and using the DOM to
change the CSS is probably the best consideration. What do I need to do to
do this (i.e., where do I need to point my nose to study?)...

In my simple example, I used an 'onclick' to show the box - actually what I
need is an onmouseover (that shows the 'hidden' layer). Will I still need to
write a 'function' to do this?

To be honest, I'm fairly adept with CSS - much less so with javascript -
other than being able to cut and paste code and manipulate the numbers to
make it do what I need (keeping the appropriate copyright information
intact, of course!).

Any advise will be appreciated.

Janice


on 11/15/01 9:05 AM, you wrote:

> Janice
> 
> [..]
>> First question - how to use a function to set variables. I have the
>> following set up as a function -
>> 
>> function locateBox(top_loc,left_loc)
>> {
>> return top_loc;
>> return left_loc;
>> }
> 
> First point, you need to understand variable scope.  These are local
> variables, their scope being within the function only.
> 
>> When clicking an image, I want to update the top_loc & left_loc variables
>> using:
>> 
>> onclick="locateBox(50,90)"
> 
> In order to relocate the div dynamically, you will have to write/use a
> cross-browser wrapper, and then manipulate the div through the Document
> Object Model (DOM). Unfortunately the DOM is different for different
> browsers, hence the need for the wrapper.
> 
>> This should update a <div> style with the appropriate numbers and move my
>> box on the map using the following:
> 
> You should hard-code the div tag initially unless there is a compelling
> reason not to. Then use the DOM to change the CSS properties.
> 
>> Now, second question - even should I get this working, am I
>> headed down the
>> wrong path??? Take a look at
> 
> Utterly, IMHO. I would suggest getting someone else to do it if there are
> time constraints, or dedicating some time and resources to actually learning
> JavaScript and CSS from scratch. A good beginner's book is "JavaScript for
> the WWW" on Peachpit Press (http://www.peachpitpress.com). They also do a
> CSS book for beginners. These books are more or less disposable; they will
> not serve for reference, but they may kickstart you in the right direction.
> As far as dHTML goes, it is more a term for the interaction between HTML,
> CSS and JavaScript than an actual technology in its own right.
> 
>> http://averra.com/mstest/testing_3.htm
>> 
>> which is using javascript to create the <div> tag - works fine 'n dandy in
>> Explorer, but not in Netscape (v4.7) - why, oh why??? This works
>> in Netscape
>> with standard html but now when generated with javascript.
> 
> Not that I've checked, but I would imagine that the reason for this is that
> NS 4.7 does not support the writeIn method, FWIW.
> 
> HTH
> 
> Chris Marsh
> 
> 
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt ! 






More information about the thelist mailing list