onclick Image

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
jisha
Forum Newbie
Posts: 1
Joined: Wed Dec 22, 2010 5:39 am

onclick Image

Post by jisha »

pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Dear friends,
I want to use image other than the silver color. I tried ... Can u help me

Code: Select all

<html>
<head>
<script language="javascript">
function color(newC,oldC,button) {
newC.bgColor= "silver"
oldC.bgColor = ""
}

</script>
</head>
<body onload="color(c1,c2,name)">
<table background="gray.gif" height="20">
<tr>
<td width="49">
<td id="c1" width="50" height="5" onclick="color(c1,c2,this)"> </td>
<td id="c2" width="50" height="5" onclick="color(c2,c1,this)"> </td>
<td width="800"></td>
</tr>
</table>
</body>
</html>

pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: onclick Image

Post by pickle »

Please explain more about what exactly you're trying to do. Run us through the process of what you want to happen.

Just looking at the code, you'll likely want to google for "Accessing DOM elements", "getElementById", and "change css with javascript".
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply