Completely solve the problem that textbox cannot be input when windowless = true

Source: Internet
Author: User
This time is used in the Silverlight application in the project.ProgramHTML content is displayed. The initial idea is to include an IFRAME In the DIV in the aspx or HTML page that contains Silverlight,
 
Then, we designed windowless = true to achieve overlapping HTML and Silverlight display. After testing, IFRAME can indeed be displayed at the same time as Silverlight, but then a big mistake is displayed,
 
That is, the basic control textbox on the Silverlight side cannot work to input Chinese characters. It can be an English character. It must be said that this is a bug in Silverlight.

After searching, I found that there is no complete solution yet, which is replaced by HTML input. However, the problem is that the position of input cannot be controlled using the built-in layout of Silverlight, next, we will consider using CSS to define z-index to put IFRAME in front of Silverlight, so that we can display HTML in front of Silverlight with windowless = false, but there is another problem, once the IFRAME focus is lost when you click the mouse on the Silverlight side, the zindex of HTML will be behind Silverlight, making HTML invisible.

In this case, we solve the problem by focusing on the IFRAME. Focus () results in Javascript. It seems that it is useless to use HTML and Silverlight on the same platform ......, However, the post on silverlight.net found a small detail, that is, assigning values to the IFRAME attribute, which seems to be an equal sign, but solves the issue of focus. Let's share the following:Code:

 <  Html >  <  Head  >      <  Title  > Tests </  Title  >      <  Script   Type = "Text/JavaScript"  > Function onmyblur () {var d = document. getelementbyid ("myid"); D. style. height = 0; D. style. height = 400; // D. focus ();} </  Script  >         <  Style   Type = "Text/CSS"  > HTML, body {Height: 100%; overflow: auto;} body {padding: 0; margin: 0 ;}# silverlightcontrolhost {Height: 100%; text-align: center ;} </  Style >  </  Head  >  <  Body  >      <  Div   ID = "Silverlightcontrolhost"  >          <  Object   Data = "Data: Application/x-silverlight-2 ,"  Type = "Application/x-silverlight-2"              Width = "100%"   Height = "100%"  >              <  Param   Name = "Source"   Value = "Clientbin/test4.xap"   />              < Param   Name = "Onerror"   Value = "Onsilverlighterror"   />              <  Param   Name = "Background"   Value = "White"   />              <  Param   Name ="Minruntimeversion"   Value = "4.0.50303.0"   />              <  Param   Name = "Autoupgrade"   Value = "True"   />              <  A   Href = "Http://go.microsoft.com/fwlink? Linkid = 149156 & V = 4.0.50303.0"  Style = "Text-Decoration: none"  >                  <  IMG   SRC = "Http://go.microsoft.com/fwlink? Linkid = 161376"   ALT = "Get Microsoft Silverlight"                      Style = "Border-style: none"   />              </  A  >         </  Object  >          <  IFRAME   ID = "_ Sl_historyframe"   Style = "Visibility: hidden; Height: 0px; width: 0px; Border: 0px"  >  </  IFRAME  >      </  Div  >     <! -- Onblur = "onmyblur ();" -->      <  Div   Style = "Background-color: Gray; position: absolute; Z-index: 1010; left: 0px; top: 0px; width: 100%; Height: 100px"  >      </  Div  >      <  Div   ID = "Mydiv"    Style ="Position: absolute; Z-index: 1010; left: 250px; top: 50px; width: 300px; Height: 400px ;"  >          <  IFRAME   ID = "Myid"   Onblur = "Onmyblur ();"    Name = "Myid"   SRC = Http://www.baidu.com"  >    </ IFRAME  >      </  Div  >  </  Body  >  </  Html  > 

I hope it will be useful to you ~

 

 

 

Please indicate the source of this blog reposted. Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.