0

I am trying to make a photo gallery, when clicking one thumb photo, it has to be shown in the showcase. but somehow the function chng1 cant be called,

<script language="javascript">
function chng1(image1,image2)
{
    alert "im here";
    document.getElementById(image1).src = document.getElementById(image2).src;

}
===============================================
   <div class = "photogrid">

   <table>
   <%
    dim i, j, src1,id
    i = 1
    j = 2
    do while i < 14
        src1 = "jor"
        id = "jor"
        src1 = src1 & i & ".jpg"
        id = id & i
    %>
        <tr style = "height:140px;width:250px;"> 
            <td style = "width:100px;">
                <image id = <%=id%>  onClick = "chng1('showcase', '<%=id%>')" src = <%=src1%> style = "position:absolute; width:100px; height:100px;">
            </td>
            <td style = "width:100px;">
                <image src = <%=src1%> style = "position:absolute; width:100px; height:100px;"></image> 
            </td>
            <td style = "width:100px;">
                <image src = <%=src1%> style = "position:absolute; width:100px; height:100px;"></image> 
            </td>
        </tr>
    <%
    i = i + 1
    loop
   %>
   </table>
   </div>

1 Answer 1

1

Js function should look like, you can't omit parentheses in JavaScript function call

function chng1(image1,image2)
{
    alert ("im here");
    document.getElementById(image1).src = document.getElementById(image2).src;

}

<image> is not valid html tag, it is <img>

<img id = <%=id%>  onClick = "chng1('showcase', '<%=id%>')" src = <%=src1%> style = "position:absolute; width:100px; height:100px;">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.