...

View Full Version : JBscript to Javascript



pooma
12-10-2006, 11:12 PM
I have some JBscript that i need to be convert to javascript so that i will work with mozilla firefox.

I can do VB promgramming but not any good at java script.

Can any one help?

<select name="Item" onclick='VBScript:UpdateItem form1,form1.item_name,form1.amount'>
<option selected="selected" value="">Select...</option>
<option value='Test|20'>test</option>
</select>

<script language='VBScript'>
Sub UpdateItem(myForm,myField1,myField2)

a=myForm.Test.value
b=split(a,"|")
if ubound(b)>0 then
myField1.value=b(0)
myField2.value=b(1)
end if

a=myForm.Item.value
b=split(a,"|")
if ubound(b)>0 then
myField1.value=b(0)
myField2.value=b(1)
end if

Many Thanks

Liam

VR2
12-11-2006, 12:28 AM
<Script>
function main()
{
// Set Event handlers here...
var myForm = document.getElementById("myForm");
var mySelect = document.getElementById("mySelect");
mySelect.onclick = updateItem(myForm, myForm.item_name, myForm.amount);
}
function updateItem(myForm, myField1, myField2)
{
var a = myForm.Test.value;
var b = a.split("|");
if (b.length > 0)
{
myField1.value = b[0];
myField2.value = b[1];
}
}
// Program Start...
window.onload = main();
</Script>

...

<form id="myForm">
<select id="mySelect">
<option selected="selected" value="">Select...</option>
<option value='Test|20'>test</option>
</select>
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum