|
-
Jan 29th, 2001, 03:29 AM
#1
Thread Starter
Hyperactive Member
Hello,
Please check this code and see if you know why it does not work!! I used to use a submit BUTTON, but I now just want to use an image. I tried putting the image "on top" of the button, but then it does not show in Netscape!!
<form name="frmprov" id="frmprov" method="POST" action="city.asp"
onSubmit="frmTest.thehidden.value=frmTest.theselect.value">
<input type="hidden" name="lstcountry" value="<%=Request.Form("lstcountry")%>"><dl>
<dd align="center"><div align="center"><center><p><select name="lstprovince"
id="lstprovince" size="1">
<%if varcountry <> "USA " then%> <option selected value "ALL">ALL</option>
<%end if%>
</select><input src="images/submit.gif" name="Submit" width="74" height="18" type="image"
onclick="redirectpage()" border="0"> </p>
</center></div></dd>
Sorry this did not come out as it should. Maybe someone can also tell me what to do if I want to submit CODE: on this forum!!??
There is some ASP code between all of this which populates a dropdown - I did not post this however!!
Hopefully you can make out what I'm trying to do. I used to use a BUTTON as the input type and it worked fine, now I want to use an image (like above) and I then get the error "frmTest is undefined".
It must have something to do with the "onsubmit" in my form section. The button "submits", but not the image!!
Thanks
T
-
Jan 29th, 2001, 04:15 AM
#2
Fanatic Member
Hi turfbult
you can use a href instead of trying to put an image in a submit button (which i think is not supported by NS)
Use the following
<a href="javascript:document.frmprov.submit();"><img src="images/submit.gif" border="0"></a>
This will work in both IE and and NS
Hope it helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jan 29th, 2001, 04:23 AM
#3
Thread Starter
Hyperactive Member
Thanks Ian,
Works like a charm!!!
T
-
Jan 29th, 2001, 04:40 AM
#4
Thread Starter
Hyperactive Member
Ian,
Maybe I talked to fast!!??
When the image/button is clicked it MUST run the redirectpage script. Because, depending on what was chosen in the dropdown one of 2 pages are loaded!!
In IE, it DOES - not in NS.
I've been battling with this since I started developing my site!!
T
-
Jan 29th, 2001, 04:44 AM
#5
Fanatic Member
sorry turfbult, I miss read your post, I c where it's going wrong change to the following in the onsubmit
frmTest.thehidden.value=frmTest.theselect.options[frmTest.theselect.selectedIndex].value
This way of getting the value works in both 
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jan 29th, 2001, 04:59 AM
#6
Thread Starter
Hyperactive Member
Ian,
This is how I did it - notice the onclick="redirectpage()">
This is what NS is "missing" (and it's only been happening since I changed from input type=button to input type=image)
<a href="javascript:document.frmprov.submit();"><img src="images/submit.gif"
border="0" onclick="redirectpage()">
The redirectpage function manages what page must be loaded - either city.asp or details.asp!!
IE = 100%. Netscape just loads city.asp everytime - even though it should load details.asp. So what I'm thinking is that NS ignores the script (redirectpage) for some reason.
This is what redirectpage looks like... (I think you still helped me with this a while ago - or Clunietp!!??)
<script language="javascript">
function redirectpage()
{
if(document.frmprov.lstprovince.options[document.frmprov.lstprovince.selectedIndex].value == 0)
{
document.frmprov.action = "details.asp";
document.frmprov.submit();
}
else
{
document.frmprov.submit();
}
}
</script>
T.
-
Jan 29th, 2001, 05:18 AM
#7
Fanatic Member
in that case mate just replace the href to
<a href="javascript:redirectpage();">
and that will call the re-direct page instead
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jan 29th, 2001, 06:15 AM
#8
Thread Starter
Hyperactive Member
Ha-ha..... don't I feel like the idiot!! Thanks Ian.
When I see javascript I go totally blank..........
Thanks again, and sorry for the trouble.
T
-
Jan 29th, 2001, 06:19 AM
#9
Fanatic Member
Don't worry about it mate, we learn by our mistakes 
If you saw me a year ago, some of the stupid mistakes I was making ... well lets not go down that road .
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|