SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Damn dirty javascript

    Could use some help guys and gals. I'm looking to create and image with various "hotspots" that trigger differant swaps (eight in total) for that image. At the same time, I'd like another image elsewhere on the page to change.

    I usually avoid all but the most simple JS like the plague (most of my work is for NGO's who want the site to be accessible to everyone down to NS1 users (ish)). However, this project is for a friend so I thought I'd have some fun.

    Any ideas how to achieve this (I could use FW, but I don't like, or understand, the code).

    Many thanks

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  2. #2
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    'sok - found a resource. If anyone is interested:

    Code:
    <HTML> 
    <HEAD> 
    <TITLE>Simple Image Rollovers</TITLE> 
    <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> 
    if (document.images) { 
    image1 = new Image 
    image2 = new Image 
    image3 = new Image 
    image4 = new Image 
    
    image1.src = "image1.jpg" 
    image2.src = "image2.jpg" 
    image3.src = "image3.jpg" 
    image4.src = "image4.jpg" 
    } 
    </SCRIPT> 
    </HEAD> 
    <BODY> 
    <a href="somewhere.html" onMouseover="document.rollover1.src=image2.src;document.rollover2.src=image4.src" onMouseout="document.rollover1.src=image1.src"> 
    <img src="image1.jpg" name="rollover1" border="0"></a> 
    <br> 
    <img src="image3.jpg" name="rollover2" border="0"> 
    </BODY> 
    </HTML>
    'nother q though. I am using php to detect browser, and serving either totally non js or js (making assumptions based on browser). This results in three script definition in the head section (with this one). Is there a limit - if so, at what point do things start going pear shaped?

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi TheOriginalH,

    RE:
    'nother q though...results in three script definition...Is there a limit...
    1) I'm not sure what you mean
    2) If you mean 3 <script> tags, you only need 1 set of tags within the head section -- unless you are specifying different scripts with contradictory specifications (for javascript1.1, javascript1.4, etc)
    3) insofar as how many 'scripts' (functions, declarations, etc) are allowed before bloat -- that has more to do with user memory -- remember, the entire page gets downloaded to the user's machine (html, images & javascript) Theoritically, there is no limit; in reality, I wouldn't try downloading a meg and expect it to work Another caveat: there may be a 'real' limit to the number of vars/functions a browser can hold -- my guess would be an int (256 -magic numbers always do things in programming languages)

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •