/    Sign up×
Community /Pin to ProfileBookmark

Random number and tracking tag

Hi all,

I have this javascript that generates a random number depending on what information is typed in a text box.

[CODE]<html>

<script language=”javascript”>
function generateRandom()
{
var i = Math.round(Math.random(1000000000,9999999999) * 10000000000);
i = document.getElementById(‘prefix’).value + i;

document.getElementById(‘randomValue’).value = i;
document.getElementById(‘output’).innerHTML = i;
}
</script>

<input type=”text” id=”prefix” onblur=”generateRandom()”>
<input type=”hidden” id=”randomValue” name=”randomValue” value=””>

<br /><br />
<div id=”output”>
<strong>Output: </strong>
</div>

</html>[/CODE]

Basically what i am trying to next is to be able to insert that value into an <img> tracking tag …..

<img src=”https://track.omguk.com/apptag.asp?APPID=YOURREF&MID=4118&PID=4225&Status=“>

A) is this possible? if so how?

Thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@dandaman2007authorMay 02.2007 — sorry forgot to say that i am trying to insert the value into the "YOURREF" section of the tracking tag

Thanks
Copy linkTweet thisAlerts:
@dandaman2007authorMay 02.2007 — Actually thinking about it...... i now how to insert the value of a TEXTBOX into the tracking tag, so if anyone knows how i can insert the random number into a TEXTBOX then that would be brilliant.

Thanks
Copy linkTweet thisAlerts:
@dandaman2007authorMay 02.2007 — Hi all,

Managed to fix it myself lol

To insert it into the text box the code is =

[CODE]<html>

<script language="javascript">
function generateRandom()
{
var i = Math.round(Math.random(1000000000,9999999999) * 10000000000);
i = document.getElementById('prefix').value + i;

document.getElementById('randomValue').value = i;
document.getElementById('output').value = i;
}
</script>

<input type="text" id="prefix" onblur="generateRandom()">
<input type="hidden" id="randomValue" name="randomValue" value="">

<br /><br />
<input type="input" id="output">

</html>[/CODE]


Thanks anyway, hope this helps some people
×

Success!

Help @dandaman2007 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...