Solved

A Href and onClick Button

Posted on 2004-04-26
7
5,727 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

688 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