#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Posts
    14
    Rep Power
    0

    need help with javascript


    Can someone help me find an alternative to the "onClick" function.
    I am trying to alter another user code. In the code below, I am trying to set the variable "nFlocBy = ByAddress" when the user does an onClick event. Can someone help me find an alternate way of coding where I want to set "nFlocBy = ByAddress" without having the user do the onclick event.

    In the code below, if address2 is not null then set the radio button to be checked and when the user click on the radio button, set nFlocBy = ByAddress. How can I skip the onclick event and make it where nFlocBy = ByAddress without having to go through the onclick event.

    If you think about it, why would the user have to click on the radio button if its already check. for some reason, my program will not work unless the button is clicked. please help

    thanks ahead

    <%

    if ((!Address2==null) || (!Address2=="")){
    strFLocBy = "2";
    ByAddress = "2";
    }
    %>
    <input type="radio" name="FLocBy" value="2"<%= Check( strFLocBy, ByAddress) %> onClick="nFLocBy=ByAddress">
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    USA
    Posts
    226
    Rep Power
    14
    I don't know if this would work for your situation, but you can always but the function in an onLoad command within the body tag. That way, the variable will be set as the page loads.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Posts
    2
    Rep Power
    0

    Lightbulb An idea I haven't tested


    what you can do is to send the event message to the radio button. I don't know if it's possible, but it should be. and my idea would flow something like this:

    function yourFunctionThatTestsSomeValue() {
    if(theObjectThatYouAreInterestedIn.hasSomeValue()) {
    /*the value that you tested was found*/
    radioObjectThatYouWantToChange.click();
    /*cause the radioobject to do whatever its onclick handler says to do*/
    }

    Check out devguu.com where I see that the radiobutton object does have this type of method.

IMN logo majestic logo threadwatch logo seochat tools logo