46 users online (0 members and 46 guests)  


  Results 1 to 5 of 5

Related

  1. How to pass an array through a form?    Forum: CGI Perl Forum
    Replies: 1
  2. Replies: 3
  3. Pass variable between php scripts.    Forum: PHP Forum
    Replies: 5
  4. Meta Tag with anchor    Forum: Website Scripts Forum
    Replies: 18
  5. Meta Tag with anchor    Forum: HTML Forum
    Replies: 12
  1. #1
    PraveenAnekalmat's Avatar
    New User

    Status
    Offline
    Join Date
    May 2007
    Posts
    7

    How to Pass Dynamic values in Anchor

    Hi Everyone..

    Please observe the below code

    Code:
    function fun(){
        for(i = 1; i < = j; i++){
            select = document.forms['MessageNew'].userId.options[i].value; 
            selection[i] = '<a href="javascript:assignValue(select);"> + select + </a>'; 
        }
    }
    Assume j = 10, looping will happen for 10 times and 10 links will appear.
    Let us assume value of 'select' is 'ABCD' when i = 1 and at i = 10, value of select will be 'XYZ' . Observe that in href we are calling one javascript function assignValue(select) and passing select in that. This javascript will be called when i click the link, even i click link number 1, XYZ will be passed to the assignValue() since looping is completed. But i need ABCD to be passed when i click link 1 and the respective values should be passed for link2,link3...,link10.
    I hope you got my prob..Please help me how can i approach the solution.
    Thanks a lot...
    Last edited by DeadMeatGF; 05-04-2007 at 05:31 AM. Reason: Code goes in [code]...[/code] tags

  2. #2
    PraveenAnekalmat's Avatar
    New User

    Status
    Offline
    Join Date
    May 2007
    Posts
    7

    Unhappy Pass Dynamic values in Anchor

    Moved this over from myspace forum - please don't cross-post.
    Last edited by DeadMeatGF; 05-04-2007 at 05:35 AM.

  3. #3
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: How to Pass Dynamic values in Anchor

    Would
    Code:
    function fun(){
        for(i = 1; i < = j; i++){
            select = document.forms['MessageNew'].userId.options[i].value; 
            selection[i] = '<a href="javascript:assignValue(select);">' + select + '</a>'; 
        }
    }
    work?
    (Note: Extra apostrophes in link)

  4. #4
    PraveenAnekalmat's Avatar
    New User

    Status
    Offline
    Join Date
    May 2007
    Posts
    7

    Re: How to Pass Dynamic values in Anchor

    Thanks for the reply..
    Sorry the code u sent is not working...it is taking select as string

  5. #5
    PraveenAnekalmat's Avatar
    New User

    Status
    Offline
    Join Date
    May 2007
    Posts
    7

    Re: How to Pass Dynamic values in Anchor

    hi DeadMeatGF,
    I am able to get the values in the function that is not my problem, but final value that is for i = 10 will go...Do i need to set any id for anchor? If so jow?
    Thanks a lot..



Tags for this Thread