Results 1 to 2 of 2
  1. #1
    mjwoodford is offline Member
    Join Date
    Sep 2009
    Posts
    6
    Rep Power
    0

    Default Set DIV tag using javascript function

    Hi,

    I have a jsp, the relevant piece as follows:

    <%@ page language="java" contentType="text/html;charset=utf-8"%>
    <%@ page session="false" %>
    <%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
    <portletAPI:init /><%
    String welcomeImage=portletResponse.encodeURL("/images/welcome_image.jpg");
    %>
    <div id="welcome_img_div" style="margin-left:5px;width:715px;height:190px;background-image:url('<%=welcomeImage%>');background-repeat:no-repeat;">

    I want to rotate the 'background-image'. I have a js function:

    <script language="JavaScript">
    var ImageArr1 = new Array("/images/Trucks0024/Trucks0024.jpg","/images/Trucks0024/Trucks0006.jpg");
    var ImageHolder1 = document.getElementById('Rotating1');


    function RotateImages(whichHolder,Start)
    {
    var a = eval("ImageArr"+whichHolder);
    var b = eval("ImageHolder"+whichHolder);
    if(Start>=a.length)
    Start=0;
    b.src = a[Start];
    window.setTimeout("RotateImages("+whichHolder+","+ (Start+1)+")",1500);
    }

    RotateImages(1,0);
    </script>

    ...but it is not clear to me how to adapt and also fit into the jsp. Please can anyone help?

    many thanks!

    Matt

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    You do realize that javascript is not java, right? Don't expect an answer to a javascript question in a java forum. :)
    My Hobby Project: LegacyClone

Similar Threads

  1. Replies: 3
    Last Post: 12-04-2009, 03:08 PM
  2. JavaScript help
    By Jeremy720 in forum New To Java
    Replies: 1
    Last Post: 11-08-2008, 10:36 PM
  3. javascript
    By fiero in forum New To Java
    Replies: 1
    Last Post: 09-22-2008, 01:45 PM
  4. scriplet in javascript function in jsp page
    By Renjini in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-21-2008, 01:07 PM
  5. Jsp and javascript
    By Ed in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-04-2007, 04:54 AM

Posting Permissions

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