Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

reference current value in menu when changing url

Posted on 2004-11-03
2
Medium Priority
?
676 Views
Last Modified: 2012-06-22
I'm using a menu to change the URL of the user's browser.  the menu is part of a PHP app and needs to pass parameter value pairs to the page that is opened.  problem that I'm having is that one of the values required is the value of the menu that is calling the MM_goToURL() fucntion (I need the value that the user is changing the menu to be part of the URL passed to the function).

this is the function that is changing the URL:

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() {
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>

this is the code that is associated with the <select> element of the form:

<select name="task_order_list" id="task_order_list" onChange="MM_goToURL('parent','/usability/custom_functions/function_lib.php?site_id=2&amp;task_id=48&amp;old_task_order=1&amp;new_task_order=task_list');return document.MM_returnValue">

                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="1"SELECTED>1</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                    </select>
 where you see :
new_task_order=task_list
I need the value that the menu has been changed to in place of 'task_list'

I know (assume) I can reference this through the DOM, but don't know how.

cheers,
0
Comment
Question by:shotokai
2 Comments
 
LVL 15

Accepted Solution

by:
mr_egyptian earned 2000 total points
ID: 12485962
I think this is what you're  looking for. I modified things a bit to make life easier:

<script language="JavaScript" type="text/JavaScript">
<!--

function MM_goToURL() {
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  sel=args[2].options[args[2].selectedIndex].value;
  args[1]+='new_task_order='+sel;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

//-->
</script>
 </head>
<body>
 <select name="task_order_list" id="task_order_list" onChange="MM_goToURL('parent','/usability/custom_functions/function_lib.php?site_id=2&amp;task_id=48&amp;old_task_order=1&amp;',this);return document.MM_returnValue">
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="1"SELECTED>1</option>
  <option value="4">4</option>
  <option value="5">5</option>
 </select>
</body>
</html>
0
 

Author Comment

by:shotokai
ID: 12486139
perfect! thx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question