Passing value from select box to next page 
Author Message
 Passing value from select box to next page

Hello all. I am playing with my Internet Explorer 6 and its context menu. I
am trying to insert a value from a select box into the url leading to the
next page, but I am doing something seouriously wrong. The first value
(sUrl) is passed from the original document and is causing no problem
(external.menuArguments is Internet Explorer 5+ I think), but I don't know
how to pass the "listValue" value from the select box. I know the value is
there because I can see it in the alert box. Should I try to submit the form
instead?
Here is my code:
terje

var oWin = window.open("", "linkdownloader",
"toolbar=no,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes
, resizable=yes, top=0, left=0, width=200, height=400");
--
var sUrl = external.menuArguments.document.URL
--
oWin.document.writeln ("<form name=\"MyForm\"><select id=\"MyList\"
name=\"MyList\" size=\"1\">");
oWin.document.writeln ("<option value=\"1\">1");
oWin.document.writeln ("<option value=\"2\">2");
oWin.document.writeln ("</select></form>");
--
oWin.document.writeln ("<script language=\"javascript\"
type=\"text/javascript\">");
oWin.document.writeln ("function myFunction(){");
oWin.document.writeln ("var listValue = document.MyForm.MyList.value");
oWin.document.writeln ("alert(listValue) }");
oWin.document.writeln ("<\/script>");
--
oWin.document.writeln ("<a href=\"NextPage.html?Url=" + sUrl + "&S=" +
listValue + " onClick = myFunction();>Next page</a>");



Fri, 29 Oct 2004 01:47:54 GMT  
 Passing value from select box to next page
The "Value" of any object is a property that must be set explicitly and
isn't the same property that referes to an option's displayed text:.
i.e. <option value="newpage.html">My Other Page</option>

To access an option's value or it's displayed text, use;

var content1 =
document.all.Form's_Name.Select_Object's_Name.options[document.all.Form's_Na
me.Select_Object's_Name.selectedIndex].value;
var content1 =
document.all.Form's_Name.Select_Object's_Name.options[document.all.Form's_Na
me.Select_Object's_Name.selectedIndex].text;


Quote:
> Hello all. I am playing with my Internet Explorer 6 and its context menu.
I
> am trying to insert a value from a select box into the url leading to the
> next page, but I am doing something seouriously wrong. The first value
> (sUrl) is passed from the original document and is causing no problem
> (external.menuArguments is Internet Explorer 5+ I think), but I don't know
> how to pass the "listValue" value from the select box. I know the value is
> there because I can see it in the alert box. Should I try to submit the
form
> instead?
> Here is my code:
> terje

> var oWin = window.open("", "linkdownloader",

"toolbar=no,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes

- Show quoted text -

Quote:
> , resizable=yes, top=0, left=0, width=200, height=400");
> --
> var sUrl = external.menuArguments.document.URL
> --
> oWin.document.writeln ("<form name=\"MyForm\"><select id=\"MyList\"
> name=\"MyList\" size=\"1\">");
> oWin.document.writeln ("<option value=\"1\">1");
> oWin.document.writeln ("<option value=\"2\">2");
> oWin.document.writeln ("</select></form>");
> --
> oWin.document.writeln ("<script language=\"javascript\"
> type=\"text/javascript\">");
> oWin.document.writeln ("function myFunction(){");
> oWin.document.writeln ("var listValue = document.MyForm.MyList.value");
> oWin.document.writeln ("alert(listValue) }");
> oWin.document.writeln ("<\/script>");
> --
> oWin.document.writeln ("<a href=\"NextPage.html?Url=" + sUrl + "&S=" +
> listValue + " onClick = myFunction();>Next page</a>");



Fri, 29 Oct 2004 19:50:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. can i pass a check box value from one page to another

2. Making a value selected in a select box.

3. Need help passing SQL Statement to Next and Previous pages for Recordset Paging

4. ASP : Passing values from One ASP to the Next

5. Passing an entire SELECT box wi/Jscript

6. passing variables from 1 web page to the next

7. Passing vairable values from page to page with VBScript

8. passing a form field value from a page to a frame's page

9. Passing Select Values

10. Passing SELECT values to ASP

11. Passing SELECT Values to ASP

12. Please Help - Passing SELECT values to ASP

 

 
Powered by phpBB® Forum Software