I am passing a javascript function values from checkbox and textbox.
The problem is that when click the button instead of opening script.php in a popup window
it redirects to script.php page.Also i don't know how to pass value of + url to script.php
popup page so it can use it. could any one tell me what i am doing wrong here.Thanks
The problem is that when click the button instead of opening script.php in a popup window
it redirects to script.php page.Also i don't know how to pass value of + url to script.php
popup page so it can use it. could any one tell me what i am doing wrong here.Thanks
Code:
//want to open a popup window and pass it value of url
url2 ='[URL unfurl="true"]http://localhost/script.php';[/URL]
name = 'chat';
var params = 'width=472,height=320,menubar=no,scrollbars=0';
var ow = window.open(url2, name, params);
Code:
<script>
function talktoServer(){
var req = newXMLHttpRequest();
//register the callback handler function
var callbackHandler = getReadyStateHandler(req, updateMsgOnBrowser);
req.onreadystatechange = callbackHandler;
//req.open("POST", "servertime.php", true);
req.open("POST", "engage3.php", true);
req.setRequestHeader("Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded");[/URL]
//get the value from the text input element and send it to server
//geting textbox data this next line
var text = document.getElementById('testmsg').value;
alert("textdata:"+text);
totalvotes = document.forms.mp3Play.totalvotes;
alert("checkboxvalue:"+totalvotes);
tempUrl ='';
url = '';
if (totalvotes.length > 0){
for (i=0; i<totalvotes.length; ++ i)
{
if (totalvotes[i].checked)
{
tempUrl =tempUrl + totalvotes[i].value +","
if (i == 30)
{
alert("Each time you can only select 30 songs to play")
return false;
}
}
}
}
else
{
alert("it is less than 0#2")
tempUrl = tempUrl + "&totalvotes=" + totalvotes.value
}
req.send("msg="+ url +"&text="+ text);
//want to open a popup window and pass it value of url
url2 ='[URL unfurl="true"]http://localhost/script.php';[/URL]
name = 'chat';
var params = 'width=472,height=320,menubar=no,scrollbars=0';
var ow = window.open(url2, name, params);
}
</script>
<div id="Last5Songs" style="WIDTH: 888px; HEIGHT: 39px">
<input type="checkbox" value="83b8e68c1605a2b71fead4cd64c166c9" name="totalvotes"></div>
<input id="testmsg" type="text" value="Hello">
<button id="playSelected" onclick="talktoServer()">Engage</button>