Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Advanced
Feb 18, 2000

Give Focus to a User-Select HTML Control in VID 6

Although the Scripting Object Model (SOM) in Visual InterDev 6 makes for quick development, it doesn't cover all the functionality that you need. For example, in Visual Basic it is easy to give any control the focus. That functionality isn't built in to VID 6, so you need a combination of server-side and client-side script. The trick is to use some inline ASP/SOM coding to generate the client-side code that gives the focus. In this snippet, the third line gives the focus (a client-side method) to a control that the user selected with a server-side control (Listbox1).

 
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function window_onload() {
document.thisForm.<%=Listbox1.getValue(Listbox1.selectedIndex)%>.focus();
}
</SCRIPT>
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>

Sub Button1_onclick()
End Sub

</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return window_onload()">
Ken Cox
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date