/    Sign up×
Community /Pin to ProfileBookmark

Just need some help from you Guys

Hi Guys,

Hope you all are having a nice day!

Just need some help from you…

I have an html page wich have a javascript code ( I can’t use php only html )

I need

[code=html]

<a id=”postos” href=”#” onClick=”open_new_window(‘http://touch.facebook.com/sharer.php?u=http:/mywebsite.com/cat1/p1.html’); return false;”><img src=”http://img607.imageshack.us/img607/1881/shareo.png” width=”60″ height=”18″ border=”0″></a>

[/code]

I need to modify the link with a random attibute so if we reload the page it will give us another link to share

so when USER[COLOR=”red”]1[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat[COLOR=”red”]1[/COLOR]/p[COLOR=”red”]1[/COLOR].html

when USER[COLOR=”red”]2[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat[COLOR=”red”]1[/COLOR]/p[COLOR=”red”]2[/COLOR].html

when USER[COLOR=”red”]3[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat1/p3.html

when USER[COLOR=”red”]1[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat[COLOR=”red”]2[/COLOR]/p[COLOR=”red”]1[/COLOR].html

when USER[COLOR=”red”]4[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat[COLOR=”red”]7[/COLOR]/p[COLOR=”red”]5[/COLOR].html

when USER[COLOR=”red”]5[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat3/p2.html

when USER[COLOR=”Red”]6[/COLOR] came to the page and click on the share button he will share the a random page:
http:/mywebsite.com/cat2/p1.html

…. etc

and so on

can you help me with this ( only javacript ( not php )

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@xelawhoApr 26.2012 — I'm not sure I see the order, but that's ok... the only thing we need to know is about the ranges:

how far can they go?

does cat go from cat0 to cat9

or what?

and p?

does it go from 0 to 9, too?

or do they both start at 1?

and how far do they go up?

and does every cat have the corresponding amount of p pages?

ad do they all go all the way from the start to the finish without skipping numbers?

we have to know to avoid broken links
Copy linkTweet thisAlerts:
@floupyauthorApr 26.2012 — the cat go from 1 to 50

and

the p go from 1 to 60

we have to randomly share a link like this

http://mywebsite.com/catX/pY.html on facebook

( with X selected randomly from 1 to 50 and Y selected randomly from 1 to 60 )

for example we could be in page:

htt://mywebsite.com/cat18/p57

and when we click the facebook share image we will share the page

htt://mywebsite.com/cat47/p19 for example
Copy linkTweet thisAlerts:
@xelawhoApr 27.2012 — like this?
[CODE]
<body>
<a id="postos" href="#" onClick="open_new_window(); return false;"><img src="http://img607.imageshack.us/img607/1881/shareo.png" width="60" height="18" border="0"></a>
<script type="text/javascript">
function open_new_window(){
var x=Math.floor(Math.random()*50)+1
var y=Math.floor(Math.random()*60)+1
window.location='http://touch.facebook.com/sharer.php?u=http:/mywebsite.com/cat'+x+'/p'+y+'.html';
}
</script>
</body>[/CODE]
×

Success!

Help @floupy 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...