Solved

A Href and onClick Button

Posted on 2004-04-26
7
5,702 Views
Last Modified: 2009-12-16
Hi I have here a link that executes a function (pops open window)  nicely but when I tried to convert it to button onClick it doesn't do what it is supposed to do. Where is my error?

The link:
<a title="comment on this post" class="h5_b" href="somepage.html" onclick="popWindow(this.href);return false;">Search!</a>

The button:
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="javascript:popWindow('somepage.html');return false;">

(the 'return false' needs to stay there)
0
Comment
Question by:champ_010
7 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10917960
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="popWindow('somepage.html');return false;">
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10917968
No, it needs not to be there.

But anyway, it should work.

Check this:
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="popWindow('somepage.html')">



0
 

Expert Comment

by:Chiller
ID: 10918601
I guess this.href doesnt work in every browser
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 16

Expert Comment

by:jaysolomon
ID: 10918636
yes it works, just buttons do not have href's
0
 
LVL 1

Author Comment

by:champ_010
ID: 10919164

Hi, neither of your samples work for my function -- it doesn't work for the button but it does work if I changed it to a link.  I need the return false there because if someone didn't have javascript turned on it would still display as a page in place of parent page instead of a pop up.
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 50 total points
ID: 10919197
if you are using a btn and JS is turned off then all the button will do is you will be able to click it but will not go or do anything

try this
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="window.open('somepage.html');">
0
 
LVL 1

Author Comment

by:champ_010
ID: 10920100

jaysolomon's comment didn't solve the button problem but it certainly answered my question--I will probably stick with using an a href for this.

Thanks.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now