helavissa
05-26-2009, 06:11 PM
Hi,
I want to pass some variables from one page to the other. Question is, why the following won't work?
<script>
var sq1;
function assignVar(value){
sq1 = value;
}
</script>
<img src="http://www.teconic.com/graphics/blue_ball.jpg" alt="blue" onmouseDown= " assignVar('1'); " />
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
document.write('<a href="displayVar.php?sq1='+sq1+'">another page</a>');
</SCRIPT>
The value of sq1 will remain undefined.
It is updating actually, but why it stays the same in query string?
Thank you for reading
I want to pass some variables from one page to the other. Question is, why the following won't work?
<script>
var sq1;
function assignVar(value){
sq1 = value;
}
</script>
<img src="http://www.teconic.com/graphics/blue_ball.jpg" alt="blue" onmouseDown= " assignVar('1'); " />
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
document.write('<a href="displayVar.php?sq1='+sq1+'">another page</a>');
</SCRIPT>
The value of sq1 will remain undefined.
It is updating actually, but why it stays the same in query string?
Thank you for reading