If it is a one handed weapon (hand crossbow, throwing axe, etc) you can hold on with the other hand and make the attack normally.
If it is a two handed weapon, you make the attack normally (with no chance of falling for bows, crossbows or similar mechanical weapons) but you suffer the other ill effects (like risking falling if you take damage) since you can't be holding on.