Difficulty on posting data to xml (making new engine)
I want to modify or update a xml in URL /s.aspx
Should i use modify url=/s.aspx or what???
but i am confused with the command how to post the data should look like:
post data=??
this is the html code:
<div id="divshoutboxcomment">
<div><input type="hidden" id="ctl00_shoutbox_txtShoutBox" name="ctl00$shoutbox$txtShoutBox" value="">
<input type="hidden" id="ctl00_shoutbox_txtShoutBox___Config" value="SkinPath=skins/silver/&HtmlEncodeOutput=true">
<iframe id="ctl00_shoutbox_txtShoutBox___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=ctl00_shoutbox_txtShoutBox&Toolbar=Basic" width="100%" height="100px" frameborder="no" scrolling="no"></iframe></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<td width="40%"><input name="ctl00$shoutbox$txtshoutnick" type="text" value="Nick" id="ctl00_shoutbox_txtshoutnick" style="width:95%;margin:0px;padding:0px"></td>
<td width="59%" align="right"><input name="ctl00$shoutbox$txtshouturl" type="text" value="http://" id="ctl00_shoutbox_txtshouturl" style="width:95%;margin:0px;padding:0px"></td>
</tr>
</tbody></table>
<div style="text-align:right"><input type="button" onclick="btnsendshout_click()" value="Pošalji"></div>
</div>
and this is the javascript:
<script type="text/javascript">
var scrolling=true;
var reloadTime=60000;
document.getElementById('shoutboxmessages').scrollTop=20000;
setTimeout("getShouts()",reloadTime)
if ( !document.all && (typeof FCKeditorAPI != "undefined") ){
var oEditor = FCKeditorAPI.GetInstance( 'ctl00_shoutbox_txtShoutBox' );
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) oEditor.MakeEditable();
}
function btnsendshout_click(){
var frmobj=document.getElementById('divshoutboxcomment');
var params='';
if (typeof FCKeditorAPI != "undefined") {
var oEditor = FCKeditorAPI.GetInstance( 'ctl00_shoutbox_txtShoutBox' );
params=params + 'text=' + escape(oEditor.GetXHTML( false ));
oEditor.SetHTML("",true)
}
else
{
params=params + 'text=' + escape(document.getElementById('ctl00_shoutbox_txtShoutBox2').value);
}
params=params + '&nick=' + escape(document.getElementById('ctl00_shoutbox_txtshoutnick').value);
params=params + '&url=' + escape(document.getElementById('ctl00_shoutbox_txtshouturl').value);
params=params + '&lastid=' + document.getElementById('ctl00_shoutbox_txtshoutlastid').value;
params=params + '&post=true';
ajaxpack.postAjaxRequest("/s.aspx", params, processPostShouts, "xml")
}
function processPostShouts(){
var myajax=ajaxpack.ajaxobj;
var myfiletype=ajaxpack.filetype;
if (myajax.readyState == 4){
if (myajax.status==200 || window.location.href.indexOf("http")==-1){
if (myfiletype=="xml"){
getShouts()
}
}
}
}
function getShouts(){
ajaxpack.getAjaxRequest("/s.aspx", "lastid=" + document.getElementById('ctl00_shoutbox_txtshoutlastid').value, processGetShouts, "xml")
setTimeout("getShouts()",reloadTime)
}
function processGetShouts(){
var myajax=ajaxpack.ajaxobj;
var myfiletype=ajaxpack.filetype;
if (myajax.readyState == 4){
if (myajax.status==200 || window.location.href.indexOf("http")==-1){
if (myfiletype=="xml"){
var xmlDoc;
xmlDoc=myajax.responseXML;
nl=xmlDoc.getElementsByTagName("i");
if (nl.length>0) {document.getElementById("ctl00_shoutbox_txtshoutlastid").value=getInnerText(nl[nl.length-1].getElementsByTagName("id")[0]) }
for (var i=0;i<nl.length;i++)
{
var newel=document.createElement("div");
newel.innerHTML="<b>" + getInnerText(nl[i].getElementsByTagName("t")[0]) + "</b> :: "
if (getInnerText(nl[i].getElementsByTagName("u")[0])=='-' || getInnerText(nl[i].getElementsByTagName("u")[0])=='http://'){
newel.innerHTML+="<b>" + getInnerText(nl[i].getElementsByTagName("n")[0]) + "</b><br />"
}
else
{
newel.innerHTML+="<b><a target='_blank' href='" + getInnerText(nl[i].getElementsByTagName("u")[0]) + "'>" + getInnerText(nl[i].getElementsByTagName("n")[0]) + "</a></b><br />"
}
newel.innerHTML+= getInnerText(nl[i].getElementsByTagName("s")[0])
var parent=document.getElementById("shoutboxmessages");
if (parent.childNodes.length>30){parent.removeChild(parent.childNodes[0])}
parent.appendChild(newel);
if (scrolling==true) {parent.scrollTop=parent.scrollHeight;}
}
}
}
}
}
function getInnerText (node) {
if (typeof node.textContent != 'undefined') {
return node.textContent;
}
else if (typeof node.innerText != 'undefined') {
return node.innerText;
}
else if (typeof node.text != 'undefined') {
return node.text;
}
else {
switch (node.nodeType) {
case 3:
case 4:
return node.nodeValue;
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += getInnerText(node.childNodes[i]);
}
return innerText;
break;
default:
return '';
}
}
}</script>
Should i use modify url=/s.aspx or what???
but i am confused with the command how to post the data should look like:
post data=??
this is the html code:
<div id="divshoutboxcomment">
<div><input type="hidden" id="ctl00_shoutbox_txtShoutBox" name="ctl00$shoutbox$txtShoutBox" value="">
<input type="hidden" id="ctl00_shoutbox_txtShoutBox___Config" value="SkinPath=skins/silver/&HtmlEncodeOutput=true">
<iframe id="ctl00_shoutbox_txtShoutBox___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=ctl00_shoutbox_txtShoutBox&Toolbar=Basic" width="100%" height="100px" frameborder="no" scrolling="no"></iframe></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<td width="40%"><input name="ctl00$shoutbox$txtshoutnick" type="text" value="Nick" id="ctl00_shoutbox_txtshoutnick" style="width:95%;margin:0px;padding:0px"></td>
<td width="59%" align="right"><input name="ctl00$shoutbox$txtshouturl" type="text" value="http://" id="ctl00_shoutbox_txtshouturl" style="width:95%;margin:0px;padding:0px"></td>
</tr>
</tbody></table>
<div style="text-align:right"><input type="button" onclick="btnsendshout_click()" value="Pošalji"></div>
</div>
and this is the javascript:
<script type="text/javascript">
var scrolling=true;
var reloadTime=60000;
document.getElementById('shoutboxmessages').scrollTop=20000;
setTimeout("getShouts()",reloadTime)
if ( !document.all && (typeof FCKeditorAPI != "undefined") ){
var oEditor = FCKeditorAPI.GetInstance( 'ctl00_shoutbox_txtShoutBox' );
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) oEditor.MakeEditable();
}
function btnsendshout_click(){
var frmobj=document.getElementById('divshoutboxcomment');
var params='';
if (typeof FCKeditorAPI != "undefined") {
var oEditor = FCKeditorAPI.GetInstance( 'ctl00_shoutbox_txtShoutBox' );
params=params + 'text=' + escape(oEditor.GetXHTML( false ));
oEditor.SetHTML("",true)
}
else
{
params=params + 'text=' + escape(document.getElementById('ctl00_shoutbox_txtShoutBox2').value);
}
params=params + '&nick=' + escape(document.getElementById('ctl00_shoutbox_txtshoutnick').value);
params=params + '&url=' + escape(document.getElementById('ctl00_shoutbox_txtshouturl').value);
params=params + '&lastid=' + document.getElementById('ctl00_shoutbox_txtshoutlastid').value;
params=params + '&post=true';
ajaxpack.postAjaxRequest("/s.aspx", params, processPostShouts, "xml")
}
function processPostShouts(){
var myajax=ajaxpack.ajaxobj;
var myfiletype=ajaxpack.filetype;
if (myajax.readyState == 4){
if (myajax.status==200 || window.location.href.indexOf("http")==-1){
if (myfiletype=="xml"){
getShouts()
}
}
}
}
function getShouts(){
ajaxpack.getAjaxRequest("/s.aspx", "lastid=" + document.getElementById('ctl00_shoutbox_txtshoutlastid').value, processGetShouts, "xml")
setTimeout("getShouts()",reloadTime)
}
function processGetShouts(){
var myajax=ajaxpack.ajaxobj;
var myfiletype=ajaxpack.filetype;
if (myajax.readyState == 4){
if (myajax.status==200 || window.location.href.indexOf("http")==-1){
if (myfiletype=="xml"){
var xmlDoc;
xmlDoc=myajax.responseXML;
nl=xmlDoc.getElementsByTagName("i");
if (nl.length>0) {document.getElementById("ctl00_shoutbox_txtshoutlastid").value=getInnerText(nl[nl.length-1].getElementsByTagName("id")[0]) }
for (var i=0;i<nl.length;i++)
{
var newel=document.createElement("div");
newel.innerHTML="<b>" + getInnerText(nl[i].getElementsByTagName("t")[0]) + "</b> :: "
if (getInnerText(nl[i].getElementsByTagName("u")[0])=='-' || getInnerText(nl[i].getElementsByTagName("u")[0])=='http://'){
newel.innerHTML+="<b>" + getInnerText(nl[i].getElementsByTagName("n")[0]) + "</b><br />"
}
else
{
newel.innerHTML+="<b><a target='_blank' href='" + getInnerText(nl[i].getElementsByTagName("u")[0]) + "'>" + getInnerText(nl[i].getElementsByTagName("n")[0]) + "</a></b><br />"
}
newel.innerHTML+= getInnerText(nl[i].getElementsByTagName("s")[0])
var parent=document.getElementById("shoutboxmessages");
if (parent.childNodes.length>30){parent.removeChild(parent.childNodes[0])}
parent.appendChild(newel);
if (scrolling==true) {parent.scrollTop=parent.scrollHeight;}
}
}
}
}
}
function getInnerText (node) {
if (typeof node.textContent != 'undefined') {
return node.textContent;
}
else if (typeof node.innerText != 'undefined') {
return node.innerText;
}
else if (typeof node.text != 'undefined') {
return node.text;
}
else {
switch (node.nodeType) {
case 3:
case 4:
return node.nodeValue;
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += getInnerText(node.childNodes[i]);
}
return innerText;
break;
default:
return '';
}
}
}</script>
Comments