www.webdeveloper.com
Results 1 to 4 of 4

Thread: Just need some help from you Guys

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Red face 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
    HTML Code:
    <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>
    

    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 USER1 came to the page and click on the share button he will share the a random page:
    http:/mywebsite.com/cat1/p1.html


    when USER2 came to the page and click on the share button he will share the a random page:
    http:/mywebsite.com/cat1/p2.html


    when USER3 came to the page and click on the share button he will share the a random page:
    http:/mywebsite.com/cat1/p3.html


    when USER1 came to the page and click on the share button he will share the a random page:
    http:/mywebsite.com/cat2/p1.html


    when USER4 came to the page and click on the share button he will share the a random page:
    http:/mywebsite.com/cat7/p5.html


    when USER5 came to the page and click on the share button he will share the a random page:
    http:/mywebsite.com/cat3/p2.html

    when USER6 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 )

  2. #2
    Join Date
    Nov 2010
    Posts
    1,088
    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

  3. #3
    Join Date
    Apr 2012
    Posts
    2
    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

  4. #4
    Join Date
    Nov 2010
    Posts
    1,088
    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>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles