Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More Webbrowser problems... 1

Status
Not open for further replies.

KyleS

Programmer
Oct 23, 2001
619
US
Hi again,

OK, I've been through this site (more times than I care to admit) and all over the net for quite a few days and have found NOTHING which will give me some insight on the collections to reference (or the properties their-in) in the WebBrowser. Obviously my Web knowledge is EXTREMELY limited, but I need to finish this project.

Last time I asked for a specific collection, thinking that was as much as I needed (the collection was that of "Buttons" and the answer was "Elements"). Now I can reference a Radio Button with no problem, but this new issue arrises as, "How do I assign a value to it?"

I know I can't use .Value or .Selected or anything of that sort, so where do I go now? I also have an issue with a combo box after this problem. I don't necessarliy need someone to hold my hand, but I have found 0 documentation on this Active-X control beyond the basic collections and events.

Thanks in advance for any help


Kyle
 
Hi Kyle,

Me again. I'm taking a break from a project right now, and I probably won't be able to get around to answering this tonight, but here's the link I use when I'm stuck:

You'll notice in the left frame, just below the Reference "folder", you have:
Objects, Properties, Methods, Collections, Events, etc...

Just above "Reference", you have Overviews/Tutorials. There's a lot of "how to" type info in the Overviews/Tutorials "folder"

Unless you've posted that you have a solution, I'll post something tomorrow.


Steve
 
Kyle,

As an afterthought, looking at Javascript code, can be extremely helpful for hacking through your ideas. I use irt.org (specifically their javascript FAQ ) for trying to hack through some of my solutions.


DevGuru is an excellent source, when you just need a handle on the syntax:
CSS: HTML: JavaScript: XHTML:
W3 Schools is also a good source.

Steve
 
Hi Kyle,

I think this is the info you want. To select a radio button the syntax is:
Code:
document.formname.RadioButtonName.status = true;

As far as the combobox goes, if you are actually talking about the select object that looks like a combo box then the syntax to select an entry from that object is:
Code:
document.formname.SelectObjectName.selectedIndex = IndexValueToSelect;

If you really meant the ActiveX combobox, then I'd have to do a little hacking to get you an answer.

Anyway, here's some code that will hopefully shed some light on the subject.

NOTE: keycode 118 is the F7 key and keycode 119 is the F8 key. So when you try this code, press F7 to test the radio buttons, and F8 to test the combobox.
Code:
<html>
<head>
<script type=&quot;text/javascript&quot;>
function checkKey(evt){
   if (evt.keyCode == 118)
      radio();
   else if (evt.keyCode == 119)
      combo();
}

function radio(){
   //Loop through all the option buttons
   //giving their values and whether they are selected
   //NOTE: option buttons are zero based arrays
   var f=document.myForm.myRadio;
   for (i=0; i<f.length; ++i){   
      alert(f[i].value + &quot;=&quot; + f[i].status);
   }
  //set the second option button
  f[1].status = true;
}

function combo(){
   //Loop through all the entries in the combobox
   //giving their values and whether they are selected
   //NOTE: text entry options are zero based arrays
   var f=document.myForm.myCombo;
   for (i=0; i<f.length; ++i){   
      alert(f[i].value+&quot; is selected =&quot; + (i==f.selectedIndex));
   }
  //set the fifth entry in the combobox
  f.selectedIndex = 4;
}
</script>
</head>
<body onkeydown=&quot;checkKey(event)&quot;>
<form name=&quot;myForm&quot;>
   1st button:<input type=&quot;radio&quot; name=&quot;myRadio&quot; value=&quot;first button&quot;><br>
   2nd button:<input type=&quot;radio&quot; name=&quot;myRadio&quot; value=&quot;second button&quot;><br>
   3rd button:<input type=&quot;radio&quot; name=&quot;myRadio&quot; value=&quot;third button&quot;><br>
   4th button:<input type=&quot;radio&quot; name=&quot;myRadio&quot; value=&quot;fourth button&quot;><br>
   5th button:<input type=&quot;radio&quot; name=&quot;myRadio&quot; value=&quot;fifth button&quot;><br>
   <br>
   <select name=&quot;myCombo&quot; size=&quot;1&quot;>
      <option value=&quot;first entry&quot;>1st entry</option>
      <option value=&quot;second entry&quot;>2nd entry</option>
      <option value=&quot;third entry&quot;>3rd entry</option>
      <option value=&quot;fourth entry&quot;>4th entry</option>
      <option value=&quot;fifth entry&quot;>5th entry</option>
      <option value=&quot;sixth entry&quot;>6th entry</option>
   </select>
</form>
<br>

</body>
</html>

Steve
 
Steve,

Where to start... well first I'd like to file a formal complaint... I wish I could give you like 50 freakin' stars.

Thanks so much, this beginner course in this stuff was immensely helpful, and I can't thank you enough.


Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top