Need help: vb.Net webbrowser and javascript.-VBForums
Results 1 to 3 of 3

Thread: Need help: vb.Net webbrowser and javascript.

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    35

    Need help: vb.Net webbrowser and javascript.

    I have an app that pulls up a webpage that has a button on it with the following code: ( I CANT change the webpages, but I can change anything in the App.)

    (Very basic button.)

    Code:
     <input type=button name="asset_link" value="AC Details" onclick=getAssetDetails()>

    From there, it pops up an external IE window with the following code:

    assetinfo.pl:

    Code:
    <title>Results of Asset Lookup </title>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <SCRIPT LANGUAGE="JavaScript"> 
    <!--
    function populateAssetInfo() {
     
     var dev_name = document.hiddenform.device_name.value;
     var model = document.hiddenform.model.value;
     var serial_no = document.hiddenform.serial_no.value;
     var os_version = document.hiddenform.os_version.value;
     var asset_tag_no = document.hiddenform.asset_tag_no.value;
     var bldg_code = document.hiddenform.bldg_code.value;
     var bldg_abbr = document.hiddenform.bldg_abbr.value;
     //var floor = document.hiddenform.floor.value;
     //var shelf = document.hiddenform.shelf.value;
     var grid = document.hiddenform.grid.value;
     var cabinet = document.hiddenform.cabinet.value;
     
     if(model=='' && serial_no =='' && os_version =='' && asset_tag_no == '' && bldg_code=='' && grid =='' & cabinet == ''){
      var msg ='Data is not available for device-'+ dev_name; 
      alert(msg);
     }
     
     window.opener.document.storageReq.model.value = model.substring(0,30);
    window.opener.document.storageReq.serial_num.value = serial_no.substring(0,30);
    window.opener.document.storageReq.device_os.value = os_version.substring(0,30);
    window.opener.document.storageReq.asset_tag_num.value = asset_tag_no.substring(0,30);

    IE errors out on the line that is bold with the following error: (Shows the little "Error on page" in the status bar.) and it doesnt copy the info like it should and then close; It just stays open.

    Code:
    Message: 'window.opener.document' is null or not an object
    Line: 25
    Char: 2
    Code: 0
    URI: https://www.xxx.zzz.com/cgi-bin/storage/getAssetInfo.pl?dev_name=server123

    Any ideas? Is something missing from my webbrowser control to where the pop up cant find/reference my control? It works fine outside of my tool but that doesnt help....

  2. #2
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,437

    Re: Need help: vb.Net webbrowser and javascript.

    Is anything being passed into model?
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    35

    Re: Need help: vb.Net webbrowser and javascript.

    Yes, al of the variables have something being passed and are valid. The error has to do with the new popup windows not being able to find the original window that opened it as I understand it.

    "Message: 'window.opener.document' is null or not an object" which is a javascript command so that is why I am here.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.