simple Javascript problem

Associate
Joined
29 Aug 2003
Posts
399
Location
North West UK
I have a submit button which i want to act as a hyperlink...

I've tried putting it inside an <a href> tag but that only works in Firefox not IE.

Using javascript I have it working using:

<input type="submit" name="Confirm" id="Confirm" value="Confirm" onclick="parent.location='http://www.google.com'" />

Which obviously takes me to google.com when clicked. However when i want to go to a page on my website such as index.html nothing happens.

Does it only support relative and not absolute addressing? It seems to work in guides on the internet, just not my site. Any ideas?
 
It should work. What does the code look like for your internal link?

Do you get a 404 or does it just do nothing? Do you get an error in firebug?
 
Works fine for me.

Do you really need JavaScript?

Code:
<form action="index.htm" method="post">
	<input type="submit" name="Confirm" id="Confirm" value="Confirm" />
</form>
 
Thanks for your help, seems to be working fine now, not entirely sure what the problem was, think it may have been down to the fact i'd included the submit button as part of one big form when it should have been a separate form. Anyways the code you posted worked so cheers :D
 
Back
Top Bottom