Jump to content

how to hyperlink an Image to Javascript?


natasha_thomas

Recommended Posts

Friends,

 

In my wordpress blog, i want to hyperlink the below Javascript to an Image....

 

<!-- TWO STEPS TO INSTALL POPUP WINDOW:

   1.  Paste the first into the HEAD of your HTML document
   2.  Use the code to open the popup page on your site  -->

<!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by:  Nic Wolfe -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=0,width=700,height=400,left = 162,top = 184');");
}
// End -->
</script>


<!-- STEP TWO: Use the following button code for the new window -->

<form>
<input type=button value="Open the Popup Window" onClick="javascript:popUp('<?php bloginfo('url');?>/my-account/shoppers-live-help-chat-system')">
</form>

<!-- Script Size:  0.73 KB  -->

 

The image URL is: www.abc.com/myimage.jpg

 

How can this be achieved?

Link to comment
https://forums.phpfreaks.com/topic/193257-how-to-hyperlink-an-image-to-javascript/
Share on other sites

The wording of your request is a little confusing. I don't know what it means to hyperlink Javascript to an image. I fyou are saying you want a Javascript function to run when the user clicks an image, then just add an onclick event to the image.

 

Based upon the button example in the code above I guess it would look something like this:

onClick="popUp('<?php bloginfo('url');?>/my-account/shoppers-live-help-chat-system');"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.