PDA

View Full Version : Trouble maintaining state of a variable being passed via query string


tinabme
07-19-2002, 01:53 PM
Hello,

I am trying to update an iframe when the user makes a selection from a select box.

I don't have any trouble with changing the iframe, but when I try to send a varible as a quey string, the variable doesn't pass to the iframe properly.

// this is in my header, and it is initiated from the onchange below.
// it changes the page fine, but doesn't read the varible "num"
// that was passed to the function

<script language="javaScript">
<!--
function updatenotes (num) {
document.getElementById("desc").src = 'iframe1.cfm?dec=num'
}
//-->
</script>

// this is the select box that initiates the function from onchange
// for simplicities sake, I hard coded 3 options, but in reality,
// these options are ever changing

<select name="Description" onchange="updatenotes(this.options[selectedIndex].value)">
<option name="">Select a project</option>
<option name="2" >project2</option>
<option name="3" >project3</option>
</select>

Any help you can offer would me ver appreciated.
thanks

x_goose_x
07-19-2002, 02:18 PM
try:

document.getElementById("desc").src = 'iframe1.cfm?dec='+num

tinabme
07-19-2002, 02:41 PM
Thanks, but I did try that, and when the page is sent, the variable (querystring) is just left blank. any other ideas?

searcyemily
09-05-2009, 11:28 AM
So you can't be bothered to explain why but we are supposed to be bothered to help? Just as well we are not as lazy as you.

As havoc said the font tag is one way but inline styles are more acceptable these days. Just echo the style="color:red;" bit inside the HTML tag.

And this is absolutely brilliant. Really your post is very good for clearing my concepts. Recently i have finished my 1z0-052 exam (http://www.actual-exams.com/1z0-052-practice-exam.htm), which i appear for attaining the certification. Although! it was not so hard to get certified but the study kept me busy whole summer. I've also attained certification of another course of XK0-002 exam (http://www.actual-exams.com/XK0-002-practice-exam.htm) which I had passed last three months back. In the same time I have completed my thesis project of 70-444 exam (http://www.actual-exams.com/70-444-practice-exam.htm) which I will going to submit it soon. I really enjoyed my stay over here and gain useful knowledge which I am sure will work for me.

ckeyrouz
09-05-2009, 07:58 PM
what is the object with id "desc", is it a frame or iframe or what?

After checking the initial post I saw it is an iframe so you try this:

parent.frameName.location.href = 'iframe1.cfm?dec='+num