-
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 :)
-
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> </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
-
I GOT IT :)
Just put a onchange function in the .js file. It works:)