Using an image with onclick instead of a hyperlinked text

liunx

Guest
I have the following code to open up a new smaller browser window from my main page. The new window is a 'contact us' form which allows them to send us an email: <br />
<br />
href=http://www.webdeveloper.com/forum/archive/index.php/"www.yoursite.com" ; onclick="window.open (this.href,'child', 'height=535,width=440,left=290,top=100,screenX=0,screenY=100');return false"style="color:#223767; font-family:Verdana, sans-serif; font-size:9pt; font-weight:700"><br />
Contact Us</a><br />
<br />
The problem is, with this code, It only allows me to open up the new window using a text link. I have an image button I would rather have on the page that they click to open the new window. Anyone know how I can alter this code to have it use an image instead of using the actual text 'Contact Us' ? <br />
<br />
I know it can easily be done using Java but I can not use a java script since this code will be on an eBay page and they do not allow java script. Any ideas?<br />
Thanks!!!<!--content-->The href you are trying to replace uses javascript and can be replaced with the following. <br />
<br />
<img src=http://www.webdeveloper.com/forum/archive/index.php/"theimage.gif" onclick="window.open('www.yoursite.com, 'child','......')><br />
<br />
I know it can easily be done using Java but I can not use a java script since this code will be on an eBay page and they do not allow java script. Any ideas?If you cannot use javascript, then how will you generate the popup window?<!--content-->Thank you for your help. I used the code you provided to create: <br />
<br />
<img src=http://www.webdeveloper.com/forum/archive/index.php/"http://images.andale.com/f2/126/115/10199094/1092118136120_contactus.gif" onclick="window.open('www.bchmedia.com/feedback1.html,'child','height=535,width=440,left=290,top=100,screenX=0,screenY=100')><br />
<br />
<br />
I am unable to get it to work. Is that the only line I need to have in my html to make it work? Any ideas of what I may be doing wrong. Thank you for your help.<!--content-->" missing here.<br />
....0,screenX=0,screenY=100')"><!--content-->Thank you again for your help but I still can not get it to work. I am new to this and I must be doing something wrong. Can anyone see what could be wrong with this script? <br />
<br />
<img src=http://www.webdeveloper.com/forum/archive/index.php/"http://images.andale.com/f2/126/115/10199094/1092118136120_contactus.gif" onclick="window.open('www.bchmedia.com/feedback1. html,'child','height=535,width=440,left=290,top=10<br />
0,screenX=0,screenY=100')"><br />
<br />
<br />
When I try to run it I get the following error:<br />
Internet Explorer Script Error<br />
Line: 11<br />
Char:48<br />
Error: Expected ')'<br />
Code: 0<br />
<br />
<br />
I've been trying to figure out how to do this all day and I'm gettting pretty burnt out. Could someone test the above script to see if you can get it to work?<br />
<br />
All help is greatly appreciated!<br />
Bryan<!--content-->Missing ' and no space allowed. url should be preceeded with <!-- m --><a class="postlink" href="http://">http://</a><!-- m --><br />
<br />
('http://www.bchmedia.com/feedback1.html','child....<br />
<br />
Is this line 11? (the one with the error)<br />
<br />
Hopefully that should do it. :)<!--content-->Unless you wan't your page to fail for everybody who doesn't use JavaScript and everybody who uses a pop-up blocker use:<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"www.yoursite.com" onclick="window.open (this.href,'child', 'height=535,width=440,left=290,top=100,screenX=0,screenY=100'); return false"><img alt="Contact us" src=http://www.webdeveloper.com/forum/archive/index.php/"contact.png" style="border:0"></a><!--content-->Thanks Charles! This is what I am looking for! Could you tell me if there is a way to remove the 'click here' text and just use the 'contact us' button instead?<br />
<br />
Thanks!!<br />
Bryan<!--content-->Okay, I figured it out myself. Thanks guys for all your help!!!<br />
Bryan<!--content-->There is no "click here" text associated with my example.<br />
<br />
And you should never use "click here" as a link text. People using Braille and audio browsers need to be able to call up a list of just the links on your page. Each link text needs to be unique and make sense out of context.<!--content-->Thanks again for your help. I figured that out. When I was first reading the script and saw the 'img alt="Contact us', I thought it was placing a 'click here' label on the page which now i know, it does not. This works great. Thank you much for all your help!<br />
Bryan<!--content-->
 
Back
Top