www.webdeveloper.com
Results 1 to 4 of 4

Thread: linking an img in javascript

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Question 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":
    <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\"><img border=\"0\" src=\"kumppanibanneri_simple.png\"></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>
    Any help you might be able to provide is appreciated. Thank you.

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    <img border=\"0\" src=\"kumppanibanneri_simple.png\" onClick=\"window.location.href='http://www.domain.com/'\" style=\"cursor:pointer;\"> should do it.
    |||||
    o . Q
    ___ "You live and you learn; or you don't live long." - Lazarus Long

    ^_^

  3. #3
    Join Date
    Apr 2012
    Posts
    2
    Oh wow, thank you so much! ^_^ This made my day. ♥
    Phew.

  4. #4
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    Glad I could help.
    |||||
    o . Q
    ___ "You live and you learn; or you don't live long." - Lazarus Long

    ^_^

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.16091 seconds
  • Memory Usage 2,886KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates