/    Sign up×
Community /Pin to ProfileBookmark

Click on text..image switches?

I’m a complete beginner with javascript, so I was hoping to get some help.
Does anyone have a code where you click on text the image below that switches?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@cgishackFeb 10.2008 — You can do this by modifying the display property

<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;script type="text/javascript"&gt;

function showEl(id)
{
var el = document.getElementById(id);
el.style.display = "";

}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a onclick="showEl('[COLOR="Red"]myImage[/COLOR]')" style="cursor:pointer;"&gt; Click me &lt;/a&gt; &lt;br /&gt;
&lt;img id="[COLOR="Red"]myImage[/COLOR]" src="http://www.webdeveloper.com/forum/images/webdev-logo2.gif" style="display:none" /&gt;
&lt;/body&gt;
&lt;/html&gt;



Drew
Copy linkTweet thisAlerts:
@766authorFeb 10.2008 — Thanks so much!

Here's the site:

http://www.execulink.com/~SecondChanceFarms/tango.html

I'm sure I'm doing something wrong here...

If I click on "photo one" and "photo two" both images so up, but I want them to switch
Copy linkTweet thisAlerts:
@cgishackFeb 11.2008 — looks like its working now.....

did you fix the issue?
×

Success!

Help @766 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...