Click to See Complete Forum and Search --> : option box with image link


Toka
09-07-2003, 02:26 AM
I have another problem for anyone that can help me. I have wrote a bit of code to select a country and go to to different pages one for english & one for chinese. It works great with a button, I want to adapt it so that instead of a button I can have a small image that when the country is selected and this is clicked it will take them to the required page for that country.

At the moment, I have the following, this is pass through html within the head within lotus notes.

<FORM ACTION="default.cgi" METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
<SCRIPT language="JavaScript"><!-- Hide the script from old browsers --

function surfto(form) {

var myindex=form.dest.selectedIndex

location=form.dest.options[myindex].value;

}

//--> </SCRIPT>
<right>
<P><SELECT NAME="dest">
<OPTION VALUE="0" selected> Select a Language </OPTION>
<OPTION
VALUE="Englishpage">English
</OPTION>
<OPTION
VALUE="Chinesepage">Mandarin</OPTION></SELECT>

<input type="button" value="Go" onClick="surfto(this.form)">
</FORM>

This works but I can't get it to work with an image instead of a button, could anyone out there help.

I have tried changing the bottom line relevant to image instead of button, but this dosen't seem work



Can any one give any suggestions



Cheers

Fang
09-07-2003, 04:03 AM
<FORM name="myform" ACTION="default.cgi" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
<SCRIPT language="JavaScript"><!-- Hide the script from old browsers --

function surfto() {
var where=document.myform.dest.options[document.myform.dest.selectedIndex].value;
if(where!="0") {
document.location.href=where+".html";
}
else {
alert("Please select a Language");
}
}

//--> </SCRIPT>
<right>
<P><SELECT NAME="dest">
<OPTION VALUE="0" selected> Select a Language </OPTION>
<OPTION VALUE="Englishpage">English</OPTION>
<OPTION VALUE="Chinesepage">Mandarin</OPTION>
</SELECT>

<a href="defaultpage.html" onclick="surfto(); return false;"><img alt="Go" src="Image.gif" height="10" width="30" /></a>
</FORM>

Toka
09-07-2003, 12:02 PM
Thanks a lot.

That code worked a treat.

Regards

Toka