Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

itemobile

macrumors newbie
Original poster
Oct 13, 2009
9
0
I am trying to get a Javascript "script" to do a function for me.

I am trying to write a a script that will run while the webpage is open, that is selected a randomized 9 digit number Less than 350000000 that will be put into a textbox and submitted. I want a adjustable time when it submits. Could this be made into an <iframe>? Also, this has to do it to a different website, not the one locally being opened.

Thank you for your help.
 
So, essentially, you're wanting a way to automatically submit data on someone else's web site form? Sounds like a spam bot.
 
its seems like a spam script, correct. But in fact, it is a database script I want to run from my iphone while evaluating clients databases. I used to run a VB-created app that did this for me. Well, I have gone more mobile, and Vb doesnt run on my iPhone sadly.

What i got so far is:

Code:
<html>
<head>
<script>
function postNumber()
{
    var randy = Math.floor(Math.random() * 250000000) +100000000;
    var fr = document.frames["postFrame"].document;
    fr.write( '<html><body>\n'
            +  '<form method="post" action="http://www.cnn.com">\n'
            +  '<input name="theNumber" value="' + randy + '">\n'
            +  '</form></body></html>');
    fr.forms[0].submit();
}
</script>
</head>
<body onload="postNumber()">
This is the main page.
<br/><br/>
<iframe name="postFrame" style="width: 100%; height: 100px;">
</iframe>
</body>
</html>
 
Looks like you're trying to write content into another web site. This is a security issue and you won't be able to get around it. Otherwise, people could put content onto anyone's web site. The better approach is to submit the data with AJAX. You can use it to send post messages. Though, the site could block these attempts, I know I do. The other way involves using curl and spam bot tactics that I won't go into. If you're submitting data to a site you own then you can easily set something up that will let you do it with AJAX.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.