DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    1

    Javascript Image Changes

    Greetings forum members!

    I've got what seems to be a simple problem calling for a simple solution, but working through it has become an issue for me.

    Okay, details. I've got a web page with images across the top. When clicking on one of the images, there is a dynamic below that shows which image you selected. The entire code for my page is simply this:

    <script language="JavaScript">
    <!--

    var backImage = new Array();

    backImage[0] = "1.gif";
    backImage[1] = "2.gif";
    backImage[2] = "3.gif";
    backImage[3] = "4.gif";

    //-----------------------------

    function changeBGImage(whichImage){
    if (document.images){
    document["rating"].src = backImage[whichImage];
    }
    }

    //-->
    </script>


    And in the body, my code looks like:

    <body>

    <form action="process.asp" method="post">
    <a href="javascript:changeBGImage(0)"><img src="1.gif" border="0"></a>&nbsp;&nbsp;
    <a href="javascript:changeBGImage(1)"><img src="2.gif" border="0"></a>&nbsp;&nbsp;
    <a href="javascript:changeBGImage(2)"><img src="3.gif" border="0"></a>&nbsp;&nbsp;
    <a href="javascript:changeBGImage(3)"><img src="4.gif" border="0"></a>&nbsp;&nbsp;
    <br><br><br>

    <img name="rating" src="norating.gif"><br><br>

    <input type="hidden" name="rating" value="rating">
    <input type="submit" value="submit">
    </form>

    </body>


    This all works beautifully, however, I want to pass a value to the next page based on what the user selects. It could be any value that identifies the selection, the important part is that it can be done. Hopefully there's a solution that can pass the value in a querystring or form. Either is fine with me.

    Now, if you want to see it in action, please go here:

    http://www.veelinx.com/javascripttest.asp

    Please tell me that I'm crazy and that it can't be done, or if by some chance there is a solution, I would be more than grateful for some insight.

    Your help is immensely appreciated!

    Thank you.
    Last edited by dangre; 08-24-2005 at 04:00 PM.

  2. #2
    Join Date
    Jul 2005
    Location
    the Netherlands
    Posts
    128
    Hi there,

    Well I don't know anything about Javascript. You posted this on the Java section of the forum. I think the Web-section of Devx (http://forums.devx.com/forumdisplay.php?f=112) would be a better place to post this, and the best chance for a quick answer.

    Good luck.

  3. #3
    Join Date
    Jan 2005
    Posts
    413
    I moved it here for better replies. But I'm pretty sure you can pass this in the url using ?variableName=someValue

Similar Threads

  1. Replies: 4
    Last Post: 10-23-2011, 02:47 PM
  2. Javascript - image changer
    By cirrus in forum Web
    Replies: 3
    Last Post: 06-18-2005, 05:55 PM
  3. Replies: 1
    Last Post: 06-12-2003, 04:00 AM
  4. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  5. Sample Sites.
    By Murray Foxcroft in forum Web
    Replies: 5
    Last Post: 11-02-2000, 02:42 AM

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links