/    Sign up×
Community /Pin to ProfileBookmark

linking an img in javascript

Hi,

I’m having some issues trying to figure out how to properly link an image in a javascript to an outside url.
I am not very familiar with javascript, though I have used it sometimes in random projects. After trying to search for ways to add a link and failing miserably I decided to turn to here for help.

Is there some way to insert a link to a different site for the image used in here?

This javascript was created by a generator in order to created “a hover ad”:

[QUOTE]

<SCRIPT language=’JavaScript’ type=text/javascript>
<!–
document.write(“<table width=’134′ height=’80’ border=’0′ cellspacing=’0′ cellpadding=’1′ style=’display:none;position:absolute;top:10px;left:10px;empty-cells:hide’ id=’v1771333963135801v181′>”);document.write(“<tr><td style=’background: #b8d26d’>”);document.write(“<table width=’100%’ height=’100%’ border=’0′ cellspacing=’0′ cellpadding=’0′>”);document.write(“<tr height=’1′><td>”);document.write(“<table width=’100%’ border=’0′ cellspacing=’1′ cellpadding=’0′ style=’background: #b8d26d; color: #FFFFFF; cursor: default’><tr style=’font-family: Arial, sans-serif; font-size: 10pt; font-weight: bold’><td>Yhteistyössä:”);document.write(“<td style=’width: 20px; cursor: pointer;’ onclick=’javascript:v1771333963135801v183();’>-“);document.write(“<td style=’width: 20px; cursor: pointer;’ onclick=’javascript:v1771333963135801v184();’>X”);document.write(“</table>”);document.write(“<tr><td>”);document.write(“<table width=’100%’ height=’100%’ id=’v1771333963135801v185′ border=’0′ cellpadding=’0′ cellspacing=’0′ bgcolor=’#FFFFFF’>”);document.write(“<tr>”);document.write(“<td>”);document.write(“<table border=”0″ cellpadding=”3″ cellspacing=”0″><tr><td><p align=”center”>[COLOR=”Red”]<img border=”0″ src=”kumppanibanneri_simple.png”>[/COLOR]</td></tr></table>”);document.write(“</table></table></table>”); if ( document.getElementById ) v1771333963135801v186 = document.getElementById ( “v1771333963135801v181” ); else v1771333963135801v186 = document.all [“v1771333963135801v181”]; var v1771333963135801v187 = undefined; var v1771333963135801v188 = false; function v1771333963135801v183 ( ) { if ( document.getElementById ) v189 = document.getElementById ( “v1771333963135801v185” ); else v189 = document.all [“v1771333963135801v185”]; if ( v189.style.display == “none” ) { v189.style.display = “”; v1771333963135801v186.style.height = “80px”; } else { v189.style.display = “none”; v1771333963135801v186.style.height = “20px”; } } function v1771333963135801v184 ( ) { v1771333963135801v186.style.display = “none”; v1771333963135801v188 = true; } var v1771333963135801v175, v1771333963135801v176; var v1771333963135801v190, v1771333963135801v191; function v1771333963135801v192 ( ) { return ( ( window.pageXOffset ) ? window.pageXOffset : document.body.scrollLeft ) + v1771333963135801v190; } function v1771333963135801v193 ( ) { return ( ( window.pageYOffset ) ? window.pageYOffset : document.body.scrollTop ) + v1771333963135801v191; } function v1771333963135801v194 ( ) { var v195 = 500; v1771333963135801v186.style.top = v1771333963135801v193 ( ); v1771333963135801v186.style.left = v1771333963135801v192 ( ); setTimeout ( “v1771333963135801v194 ( );”, v195 ); } function v1771333963135801v197 ( v198 ) { if ( v1771333963135801v190 != v1771333963135801v175 || v1771333963135801v191 != v1771333963135801v176 ) { if ( v1771333963135801v190 != v1771333963135801v175 ) if ( Math.abs ( v1771333963135801v190 – v1771333963135801v175 ) <= v1771333963135801v199 ) v1771333963135801v190 = v1771333963135801v175; else if ( v1771333963135801v190 < v1771333963135801v175 ) v1771333963135801v190 += v1771333963135801v199; else v1771333963135801v190 -= v1771333963135801v199; if ( v1771333963135801v191 != v1771333963135801v176 ) if ( Math.abs ( v1771333963135801v191 – v1771333963135801v176 ) <= v1771333963135801v199 ) v1771333963135801v191 = v1771333963135801v176; else if ( v1771333963135801v191 < v1771333963135801v176 ) v1771333963135801v191 += v1771333963135801v199; else v1771333963135801v191 -= v1771333963135801v199; v1771333963135801v186.style.top = v1771333963135801v193 ( ); v1771333963135801v186.style.left = v1771333963135801v192 ( ); setTimeout ( “v1771333963135801v197 ( ” + v198 + ” );”, 20 ); } else if ( v198 ) v1771333963135801v194 ( ); else v1771333963135801v186.style.display = “none”; } function v1771333963135801v200 ( v201, v202 ) { v1771333963135801v175 = v201; v1771333963135801v176 = v202; v1771333963135801v190 = v201; v1771333963135801v191 = v202; var v205 = 0, v206 = 0; v205 = -v201 -134; v206 = -v202 -80; if ( v205 != 0 && v206 != 0 ) if ( Math.abs ( v205 ) < Math.abs ( v206 ) ) v206 = v206 / Math.abs ( v206 ) * Math.abs ( v205 ); else v205 = v205 / Math.abs ( v205 ) * Math.abs ( v206 ); v1771333963135801v190 += v205; v1771333963135801v191 += v206; v1771333963135801v186.style.top = v1771333963135801v193 ( ); v1771333963135801v186.style.left = v1771333963135801v192 ( ); v1771333963135801v186.style.display = “”; v1771333963135801v197 ( true ); } function v1771333963135801v196 ( ) { if ( v1771333963135801v188 ) return; v1771333963135801v199 = undefined; var v205 = 0, v206 = 0; var v201 = v1771333963135801v175, v202 = v1771333963135801v176; v205 = -v201 -134; v206 = -v202 -80; if ( v205 != 0 && v206 != 0 ) if ( Math.abs ( v205 ) < Math.abs ( v206 ) ) v206 = v206 / Math.abs ( v206 ) * Math.abs ( v205 ); else v205 = v205 / Math.abs ( v205 ) * Math.abs ( v206 ); v1771333963135801v175 += v205; v1771333963135801v176 += v206; v1771333963135801v186.style.top = v1771333963135801v193 ( ); v1771333963135801v186.style.left = v1771333963135801v192 ( ); v1771333963135801v186.style.display = “”; v1771333963135801v197 ( false ); } var v1771333963135801v199 = 16.970725498515062; setTimeout ( “v1771333963135801v200 ( 1, 1, 16.970725498515062 );”, 1500 ); var v1771333963135801v217, v1771333963135801v218; function v1771333963135801v219 ( v220 ) { v221 = ( document.all ) ? event.clientX : v220.clientX; v222 = ( document.all ) ? event.clientY : v220.clientY; v1771333963135801v190 += v221 – v1771333963135801v217; v1771333963135801v191 += v222 – v1771333963135801v218; v1771333963135801v217 = v221; v1771333963135801v218 = v222; v1771333963135801v186.style.top = v1771333963135801v193 ( ); v1771333963135801v186.style.left = v1771333963135801v192 ( ); } function v1771333963135801v223 ( ) { } function v1771333963135801v224 ( ) { document.onmousemove = v1771333963135801v223; document.onmouseup = v1771333963135801v223; } function v1771333963135801v225 ( v220 ) { v1771333963135801v217 = ( document.all ) ? event.clientX : v220.clientX; v1771333963135801v218 = ( document.all ) ? event.clientY : v220.clientY; document.onmousemove = v1771333963135801v219; document.onmouseup = v1771333963135801v224; } v1771333963135801v186.onmousedown = v1771333963135801v225;
//–>
</SCRIPT>

[/QUOTE]

Any help you might be able to provide is appreciated. Thank you.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@WolfShadeApr 09.2012 — <img border="0" src="kumppanibanneri_simple.png" [COLOR="Red"]onClick="window.location.href='http://www.domain.com/'" style="cursor:pointer;"[/COLOR]> should do it.
Copy linkTweet thisAlerts:
@etopalauthorApr 09.2012 — Oh wow, [B]thank you[/B] so much! ^_^ This made my day. &#9829;

Phew.
Copy linkTweet thisAlerts:
@WolfShadeApr 09.2012 — Glad I could help.
×

Success!

Help @etopal 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.13,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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