I have the following code that is triggered by a button on a form...
The element PtQ can have a value of 1, 2 or 3
I placed the Alerts to see where the code goes wrong.
The problem I have is that no matter what the value of PtQ the first Alert box will show the correct value of PtQ but the if else statement will always trigger the Alert("PQ3") which should only trigger if the value of PtQ is 3
Any assistance is figuring this one out would be appreciated.
Regards
Mych
Code:
function ComposeGMQ()
{
var PQ = document.getElementById('PtQ').value
alert("PQ=" + PQ) [red]This will always show the value of PtQ [/red]
var DPC= document.getElementById('DstPcode').value
DPC = DPC.toUpperCase()
DPC.replace(" ", "+")
var GMQ= ""
if (PQ = 3)
{
alert("PQ3") [red]No matter what the value of PQ which should be the same as PtQ this alert always triggers [/red]
Some extra code....
}
else if (PQ = 2)
{
alert("PQ2")
Some other Code....
}
else
{
alert("PQ1")
Even more Code
}
win = window.open(GMQ, "js");
The element PtQ can have a value of 1, 2 or 3
I placed the Alerts to see where the code goes wrong.
The problem I have is that no matter what the value of PtQ the first Alert box will show the correct value of PtQ but the if else statement will always trigger the Alert("PQ3") which should only trigger if the value of PtQ is 3
Any assistance is figuring this one out would be appreciated.
Regards
Mych