Jump to content

document.getElementById() problem


helloise

Recommended Posts

i have this line of code:

     <a href="#" id="profilelink" name="profilelink" value="<?php echo $id."/".$block_record;?>" onClick="return viewornot(<?php echo $id; ?>)"><?php echo $uniqueCode; ?></a>

so with the onclick i want to pass the id concatenated with a blocked id to my JS:

    function viewornot()
    {
        var val = document.getElementById('profilelink');
        var e = confirm('Do you want to view this profile?');
     
        if (e == true)
        { 
           //for live site
           window.location.href = "http://www.rainbowcode.net/index.php/profiles/showprofilepersonal?id="+id;
           return true;
        }
        else
        {
            //if val contains a 1 then user is blocked
            //display a message then
        }
        return false
    }      

 

the line: var val = document.getElementById('profilelink'); is not giving me what i want

it should contain the user id concatenated with a 1(blocked) or 0(not blocked)

($id."/".$blocked_user)

 

can someone help me please?

thank you

Link to comment
https://forums.phpfreaks.com/topic/236931-documentgetelementbyid-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.