PDA

View Full Version : Help with Javascript POST



VsUK
03-19-2010, 11:58 PM
For the record, im a noob at javascript & if there was a lvl below noob id use it to :D

Anyways, my code blow is supposed to automate on a website i use a quantity & submit with just one click using javascript. The help i got wasn't successful as it dosnt act as a URL or interact with the webpage & i need it to be used as a URL.

My Goal is to make a simple php page which i already have & a list of links. Now the links will be made up of javascript as soon as i get a working example i can edit. When i click the links, on the webpage it automatically sets quantity & hits the Sell submit button for me, however it dosnt work & im desperate to get it fixed. On the webpage is a slider that sets the quantity, i can manually set quantity as we have to use a slider we click & drag left or right then we click Sell & it sells the type of drugs which is part of the game we wanted. I grabbed the POST info using Live Headers firefox plugin. I hope someone can fix this for me.

Live Headers info:

POST /fiends.php drugtype=lsd&sqty=5201
Javascript Code:

1."href="javascript:
2.var doc = document;
3.var aForm = doc.createElement("form");
4.doc.getElementsByTagName("body")[0].appendChild(aForm);
5.aForm.setAttribute("action", "http://www.greedinc.com/fiends.php?drugtype=lsd&sqty=5201");
6.aForm.setAttribute("method", "POST");
7.
8.var aInput = doc.createElement("input");
9.aForm.appendChild(aInput);
10.aInput.setAttribute("type", "hidden");
11.aInput.setAttribute("name", "drugtype");
12.aInput.value = "lsd";
13.
14.aInput2 = doc.createElement("input");
15.aForm.appendChild(aInput2);
16.aInput2.setAttribute("type", "hidden");
17.aInput2.setAttribute("name", "sqty");
18.aInput2.value = '5201';
19.aForm.submit();">

As a reminder, The javascript i need will act as a URL on my own hosted php page. I will then open the PHP page as a sidebar in my browser which will be firefox. Then when im on the website in question on the specific page, in staid of click & dragging the slider thats part of the POST/Submit that changes the Quantity of what i want sell & then click Sell. I want the javascript acting as a URL to do that for me from the sidebar page.

Really hope someone can fix this for me because I've been at it for nearly 3 weeks now & its starting to wear me down to a point where I'm eating Jelly Babies :(

stringcugu
03-20-2010, 09:09 AM
<script>//--------------------------------------------------------------------------------------------------
// All material contained within this and associated downloaded pages is the property of 4thorder(TM)
// Copyright 2005.All rights reserved.
//
// Author: Michael Falatine || Authors email: 4thorder@4thorder.us
//
// USAGE: You may use this script for commercial or personal use, however, the copyright is retained-
// by 4thorder (TM).
//
// For other free Scripts visit: http://www.4thorder.us/Scripts/
//---------------------------------------------------------------------------------------------------
// :::::::::::::::::::::::::
// :::: Global Variables :::
// :::::::::::::::::::::::::
var firstLoad=0;
var GlobalECState=0; // 0=collapsed, 1=expanded; used for inital state of ALL branches
// :::::::::::::::::::::::::
// :::: Global Functions :::
// :::::::::::::::::::::::::
window.onload=InitializePage;
function InitializePage()
{
Headers();
attachEventhandlers();
}
// Attach event handlers to all images within container
function attachEventhandlers()
{
mainTABLEElement=document.getElementById("mainTable");
TABLECollection=mainTABLEElement.getElementsByTagName("TABLE");
if (TABLECollection!=null)
{for (l=0; l<TABLECollection.length; l++)
{
THCol=TABLECollection.item(l).getElementsByTagName("TH");
THCol.item(0).onclick=onclickHandler;
}
}
}
function Headers()
{
mainTABLEElement=document.getElementById("mainTable");
TABLECollection=mainTABLEElement.getElementsByTagName("TABLE");

if (TABLECollection!=null)
{
for (z=0; z<TABLECollection.length; z++)
{
TRCol=TABLECollection.item(z).getElementsByTagName("TR");
THCol=TABLECollection.item(z).getElementsByTagName("TH");

if(firstLoad==0)
{ // Yes: FIRST LOAD OF PAGE - set inital ECState
if(GlobalECState==0)
{// Global ECState is COLLAPSED (+) (0)
THCol.item(0).setAttribute("ECState",0);
for (j=1; j<TRCol.length; j++)
{
TRCol.item(j).style.display='none';
}
}
else
{// Global ECState is EXPANDED (-) (1)
THCol.item(0).setAttribute("ECState",1);
for (k=1; k<TRCol.length; k++)
{
TRCol.item(k).style.display='block';
}
}
}
else// No: FIRST LOAD OF PAGE - change ECState
{// Grab ECState and expand or collapse branch
State=THCol.item(0).getAttribute("ECState");
if(State==0)
{
// ECState is COLLAPSED (+) (0)
for (l=1; l<TRCol.length;l++)
{
TRCol.item(l).style.display='none';
}
}
else
{
// ECState is EXPANDED (-) (1)
for (m=0; m<TRCol.length; m++)
{
TRCol.item(m).style.display='block';
}
}
}
}
}
if(firstLoad==0){firstLoad=1;}
}
// ::::::::::::::::::::::::
// :::: Event Handlers ::::
// ::::::::::::::::::::::::
function onclickHandler(e)
{
// Browser compatibility code
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
// Toggle ECState
State=targ.getAttribute("ECState");
if(State==0)
{targ.setAttribute("ECState",1);}
else{targ.setAttribute("ECState",0);}
Headers();
}</script>

stringcugu
03-20-2010, 09:10 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0045)http://www.allwebfree.it/listascript/807.html -->
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE>TH {
BORDER-BOTTOM: #000000 1px solid; TEXT-ALIGN: center; BORDER-LEFT: #000000 1px solid; BACKGROUND-COLOR: #b9e9ff; FONT-FAMILY: Tahoma; COLOR: #005984; FONT-SIZE: 10pt; BORDER-TOP: #000000 1px solid; CURSOR: pointer; BORDER-RIGHT: #000000 1px solid
}
TR {
BORDER-BOTTOM: #000000 0px solid; TEXT-ALIGN: center; BORDER-LEFT: #000000 0px solid; BACKGROUND-COLOR: #005984; FONT-FAMILY: Tahoma; COLOR: #8cdaff; FONT-SIZE: 10pt; BORDER-TOP: #000000 0px solid; CURSOR: pointer; BORDER-RIGHT: #000000 0px solid
}
A:link {
FONT-FAMILY: Tahoma; COLOR: #8cdaff; FONT-SIZE: 10pt; TEXT-DECORATION: none
}
A:hover {
FONT-FAMILY: Tahoma; COLOR: white; FONT-SIZE: 10pt; TEXT-DECORATION: none
}
A {
FONT-FAMILY: Tahoma; COLOR: #8cdaff; FONT-SIZE: 10pt; TEXT-DECORATION: none
}
TABLE.mainTable {
BORDER-BOTTOM: 4px groove; BORDER-LEFT: 4px groove; BORDER-COLLAPSE: collapse; BORDER-TOP: 4px groove; BORDER-RIGHT: 4px groove
}
</STYLE>
<SCRIPT language=JavaScript type=text/javascript
src="807_files/807DHTMLMenuExpander.js"></SCRIPT>

stringcugu
03-20-2010, 09:11 AM
<META name=GENERATOR content="MSHTML 8.00.6001.18876"></HEAD>
<BODY style="BACKGROUND-COLOR: #f2fbff">
<TABLE id=mainTable border=1 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<TABLE border=1 cellSpacing=0 cellPadding=0>

<TBODY>
<TR>
<TH width=150>Menu Header 1</TH></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
a</A></TD></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
b</A></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD>
<TABLE border=1 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TH width=150>Menu Header 2</TH></TR>

<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
a</A></TD></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
b</A></TD></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
c</A></TD></TR>

stringcugu
03-20-2010, 09:12 AM
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
d</A></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD>
<TABLE border=1 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>

<TH width=150>Menu Header 3</TH></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
a</A></TD></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
b</A></TD></TR>
<TR>
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
c</A></TD></TR>
<TR>

stringcugu
03-20-2010, 09:12 AM
<TD width=150><A
href="http://www.allwebfree.it/listascript/807.html">Sub selection
d</A></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD>
<TABLE border=1 cellSpacing=0 cellPadding=0>

stringcugu
03-20-2010, 09:13 AM
<TBODY>
<TR>
<TH width=150>Menu Header
4</TH></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><A
href="http://www.4thorder.us/Scripts/" target=_blank><FONT
size=1>4thorder<SUP>(TM)</SUP> Full Scripts</FONT></A> </BODY></HTML>

VsUK
03-20-2010, 11:28 AM
Im sorry but what the hell does all that crap got to do with my problem? stop spamming my thread plz.