Javascript homepage button acting wierd

Posted on 2011-05-06
Last Modified: 2012-08-14
Here's my code:

<INPUT TYPE="image"  SRC="images/homepage_button.jpg" width="200" height="17" border="0" onClick="'url(#default#homepage)';
                        this.setHomePage('<?php echo $contestant_id; ?>');">

It works. My homepage becomes the page I've got referenced. The only snag is that as soon as youc click the button, the page gets an error because the URL has some random code as the id number, consequently you get all kinds of errors.

Again, the page is made the homepage, but in the process the page refreshes with the same URL, but you've got a different set of characters for the id number. In this case, instead of the URL being, instead the page you get after you click the button is

What am I missing?
Question by:brucegust
    LVL 82

    Accepted Solution

    An 'image' button is a 'submit' button by definition and the "x=80&y=10" are the coordinates in the image where you clicked.
    LVL 82

    Assisted Solution

    by:Dave Baldwin
    LVL 107

    Expert Comment

    by:Ray Paseur
    What are you trying to get to happen here.  Please just tell us in plain language, thanks. ~Ray
    LVL 107

    Assisted Solution

    by:Ray Paseur
    Wonder if this design pattern might work - just use a link:

    Author Closing Comment

    Dave's suggestions explained where I was getting the bizarred URL (the x and y coordinates). I found another script that accommodated the button that I wanted to use as well as different browser types. That "direction" came about as an indirect result of Ray's suggestion which had sound code, but didn't accommodate anything other than IE. Taken together, we got it done!
    LVL 82

    Expert Comment

    by:Dave Baldwin
    Good, glad you got it done.  Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    php simulator 5 56
    Pass data between components in angular 1.5 10 41
    multidimensional array 4 18
    VB.NET Server side Javascript 8 42
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now