This works fine in Firefox, but does nothing in IE. Here's the code:
<input type="image" scr="http://www.site.com/new/images/contshop.png" onclick = "window.open ('http://www.site.com/index.php', '_self');" />
<input type="image" src="http://www.site.com/new/images/checkout.png" onclick = "if (ChkOpts ()) document.forms.ppform.submit ();" />
I just wanted to add that neither button works with IE. Do I need to enclose these in a <script> for javascript perhaps?
I've been working on this for several hours, trying to find out why either button won't work in IE with no luck. I'm open to suggestions, please help!
SyntaxError
10-27-2007, 07:56 PM
<input type="image" scr="http://www.site.com/new/images/contshop.png" onclick = "window.open ('http://www.site.com/index.php', '_self');" />
<input type="image" src="http://www.site.com/new/images/checkout.png" onclick = "if (ChkOpts ()) document.forms.ppform.submit ();" />
First, posting in the correct forum could help.
Second: you could do it this way, though, might make it easier on you if on the first button if you change it to an image tag and you anchor it via the <a> tag
<a href="http://www.site.com/index.php" target="_self">
<img scr="http://www.site.com/new/images/contshop.png" />
</a>
And, for the other, I'd need to see more code.
jjohnson2458
12-30-2010, 11:21 PM
After a few headaches, I got this to work:
<script type="text/javascript">
function processForm(myform,obj){
var formId=myform.getAttribute("id");
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", obj.name);
hiddenField.setAttribute("value", obj.value);
myform.appendChild(hiddenField);
}
</script>
In the html:
<form action="{$self}" id="loginForm" method="post">
<input name="action" id="action" value="login" class="button" type="image" src="{imageUrl}" onclick="processForm(this.form,this)";/>
</form>
Works in IE , FF, and Chrome
Hope this helps someone,
JJ