• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

Javascript homepage button acting wierd

Here's my code:

<INPUT TYPE="image"  SRC="images/homepage_button.jpg" width="200" height="17" border="0" onClick="this.style.behavior='url(#default#homepage)';
                        this.setHomePage('http://www.countryshowdown.com/Texaco/contestant.php?id=<?php echo $contestant_id; ?>');">
                        </FORM>&nbsp;

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 http://www.countryshowdown.com/Texaco/contestant.php?id=19022, instead the page you get after you click the button is http://www.countshowdown.com/Chevron/contestant.php?x=80&y=10

What am I missing?
0
brucegust
Asked:
brucegust
  • 3
  • 2
3 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
An 'image' button is a 'submit' button by definition and the "x=80&y=10" are the coordinates in the image where you clicked.
0
 
Dave BaldwinFixer of ProblemsCommented:
0
 
Ray PaseurCommented:
What are you trying to get to happen here.  Please just tell us in plain language, thanks. ~Ray
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Ray PaseurCommented:
Wonder if this design pattern might work - just use a link:
http://javascript.internet.com/miscellaneous/set-home-page.html
0
 
brucegustPHP DeveloperAuthor Commented:
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!
0
 
Dave BaldwinFixer of ProblemsCommented:
Good, glad you got it done.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now