46 users online (0 members and 46 guests)  


  Results 1 to 2 of 2

Related

  1. VBScript/Html Help    Forum: HTML Forum
    Replies: 1
  2. Replies: 2
  3. VBscript Check box help    Forum: Javascript Forum
    Replies: 1
  4. Drop down menu difficulty    Forum: Javascript Forum
    Replies: 6
  5. VBScript Functions    Forum: Website Scripts Forum
    Replies: 1
  1. #1
    dsnorm's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2006
    Posts
    3

    VBscript difficulty

    Here is the code:

    <script language="vbscript">
    <!--
    dim bit1
    dim bit2
    bit1 = 0
    bit2 = 0

    function pic1(bit1)
    if bit1 < 1 then
    pic1 = "L00011A.gif"
    else
    pic1 = "L00011B.gif"
    end if
    end function

    function pic2(bit2)
    if bit2 < 1 then
    pic2 = "L00013A.gif"
    else
    pic2 = "L00013B.gif"
    end if
    end function
    //-->
    </script>
    <body>
    <H1>T100 Web Page</H1>
    <FORM ACTION="http://<!--#exec cgi="/get_ipaddr.fn"-->/set_device.fn" METHOD="POST" NAME="M0Form">
    Start Bit:
    <INPUT size=10 maxlength=10 name="M0" value=<!--#exec cgi="/get_device.fn M0"-->>
    <input name="M0Submit" type="submit" value="Update">
    </FORM>
    <script language="vbscript" for="M0Submit" event="OnClick">
    <!--
    Dim theForm
    Set theForm = Document.forms("M0Form")
    if IsNumeric(theForm.M0.value) then
    if theForm.M0.value < 0 Or theForm.M0.value > 1 then
    MsgBox "Only a 1 or a 0 are valid entries for this field"
    end if
    else
    MsgBox "Please enter a 1 or a 0 only"
    end if
    //-->
    </script>
    <IMG alt="" src=pic1()> <---calling first function here

    <FORM ACTION="http://<!--#exec cgi="/get_ipaddr.fn"-->/set_device.fn" METHOD="POST" NAME="M1Form">
    Stop Bit:
    <INPUT size=10 maxlength=10 name="M1" value=<!--#exec cgi="/get_device.fn M1"-->>
    <input name="M1Submit" type="submit" value="Update">
    </FORM>
    <script language="vbscript" for="M1Submit" event="OnClick">
    <!--
    Dim theForm
    Set theForm = Document.forms("M1Form")
    if IsNumeric(theForm.M1.value) then
    if theForm.M1.value < 0 Or theForm.M1.value > 1 then
    MsgBox "Only a 1 or a 0 are valid entries for this field"
    end if
    else
    MsgBox "Please enter a 1 or a 0 only"
    end if
    //-->
    </script>
    <IMG alt="" src=pic2()> <---calling second function here

    With the script functions I wrote I am trying to conditionally display images that reside in the same folder as the html page. The condition will be a value of either 1 or 0, which is given by the 'get_device.fn' . This function is supplied by our HMI panel manufacturer and essentially retrieves a value from the panel. These functions work fine, but I seem unable to set the returned value to the vbscript variables. I have just placed a 0 value in the variables to see if the first image option will display and they will not, so something is missing with regards to my understanding of how the functions work in scripting. Notice I am calling the functions, to return the image name, as the 'src' for the image.

    Thanx in advance
    dsnorm
    Last edited by HTML; 03-20-2007 at 08:45 PM.

  2. #2
    dsnorm's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2006
    Posts
    3

    Smile Re: VBscript difficulty

    I have resolved this issue by re-writing the functionality using javascript. Should have started there in the first place
    I would have just edited my post but, although it says I can edit my posts, I see no 'button' to allow this. Perhaps someone can 'open' my eyes for this feature.

    dsnorm

    EDIT - It seems I can edit my replies but not my original post



Tags for this Thread