Results 1 to 3 of 3

Thread: Javascript help needed.. Test your knowledge!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    118

    Question

    Hi every1.

    I got one question.

    I have my HTML page. I have a .js file . It is a just a combobox with a few values. I inlcude the .js file in my HTML page like <Script language = "javascript" Src = "jsfile.js"> .

    The trick is it ACTUALLY works. I see the combobox everything. BUT how do I refernence the values/ onchange event of the combo box.

    In VBScript it works by using (in the HTML page)
    <Script ....>

    Sub Combo1_onchange()
    msgbox combo1.value
    End sub

    </Script>

    But how do you do it in Javascript. I tried using the onchange in the .js file but to no avail

    Thanks

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    118
    THanks for the reply You answered my question and gave me a great idea.

    But can I also ask.

    HTML Page :
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    </HEAD>

    <Script Language = "Vbscript">

    sub select1_onchange

    msgbox select1.value

    End Sub

    </Script>


    <BODY>

    <P>&nbsp;</P>


    <Script language = "javascript" src = "comb.js"> </Script>

    </BODY>
    </HTML>
    ----------------------------------------------------------------

    comb.js

    document.writeln('<SELECT id=select1 name=select1>')
    document.writeln('<OPTION value = "one"> 1 </OPTION>')
    document.writeln('<OPTION value = "two"> 2 </OPTION>')
    document.writeln('<OPTION value = "three"> 3 </OPTION>')
    document.writeln('</SELECT>')

    -----------------------------------------------------------------

    P.S sorry about the spacing.


    The HTML page vbscript works. But how will I do the same in Javascript. I tried puting a function in the .js file but it doesn't work. How do I reference the select1 box?

    Thanks

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    118
    I GOT IT

    Just put a onchange function in the .js file. It works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width