469,322 Members | 1,633 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

using focus() in navigation between frames.

Could somebody help me ? I have a left frame and right frame in a page. There is a form in right frame which has number of text box, checkbox, radio button, some static text's. For every input item (and for some static text too), I have link in left frame.

When I click in the left frame, I called a function like right frame.formName.item.focus() and cursor is placed in the input item of right frame. But this works only for the elements with focus() method. But I need to show the input item ( for radio, check box also ) , I have to show in right screen when the user clicks in the left screen. And I understand we can call focus() only for element in which we can place cursor.

So what I need is when I click the link in the right screen, the corresponding item ( whatever it is, radio, check or static text too) should be displayed (focussed!?) in the right screen.
Aug 17 '07 #1
5 1943
acoder
16,027 Expert Mod 8TB
Post your code.

You can give focus to radio buttons and check boxes, e.g. see link.
Aug 17 '07 #2
Post your code.
You can give focus to radio buttons and check boxes, e.g. see link.

Yes. This is how i set focus for radio and check box. But as I mentioned, i need to focus ( not exactly focus. Jus to display in screen) for some static text too.

Here is my code.

Expand|Select|Wrap|Line Numbers
  1. function showChapter(chapterName) {
  2. /* THIS METHOD IS USED TO DISPLAY AND FOCUS SELECTED CHAPTER */
  3.  
  4. var elemArray=document.getElementsByName(chapterName);
  5. if(elemArray!=null) {
  6.     for(var i=0;i<elemArray.length;i++) {
  7.         if(elemArray[i].type=="text" || elemArray[i].type=="checkbox" || elemArray[i].type=="radio"  || elemArray[i].type=="textarea" ) {
  8.                 elemArray[i].focus();
  9.                 break;
  10.         }
  11.     }
  12. }
  13. else {
  14.     //no such element
  15. }
  16. }
  17.  
  18. /*every chapter is an element in right side .That may be any input type or even 
  19. a static text.
  20. */
  21.  
My main issue is I have to display static text also.
Aug 17 '07 #3
acoder
16,027 Expert Mod 8TB
What does the static text look like? Give an example.
Aug 17 '07 #4
What does the static text look like? Give an example.
actually right frame content is generated by XSL. It looks like something below :

Expand|Select|Wrap|Line Numbers
  1. <section id="1-1-1" name="Name">
  2. <format type="textbox" maxlen="32" />
  3. </section>
  4.  
  5. <section id="1-1-2" name="Address">
  6. <format type="textarea" maxlen="70" />
  7. </section>
  8.  
  9. <section id="1-1-3" name="Sex">
  10. <format type="radio button" value="male,female"/>
  11. </section>
  12.  
  13. <section id="1-1-4" name="Fill below sections">
  14. <format type="label" value="All inputs are mandatory"/>
  15. </section>
After generating as HTML:

Expand|Select|Wrap|Line Numbers
  1. Name :<input type="text" name="1-1-1" > <br/>
  2.  
  3. Address :<textarea name="1-1-2"></textarea> <br/>
  4.  
  5. Sex :<input type="radio" name="1-1-3" >male <br/>
  6.         <input type="radio" name="1-1-3" >female<br/>
  7.  
  8. Fill below sections <br/>
  9. All inputs are mandatory <br/>
.................


If it is required, I can place this label inside a div tag or something, since I need to display while I click in left frame. ( Display in the sense, Assume section's 1 to 10 are visible in right screen. I click left frame link for 20th section, which is a label/static text in the right frame and it should be scrolled up in the screen ).
Aug 18 '07 #5
acoder
16,027 Expert Mod 8TB
If it is required, I can place this label inside a div tag or something, since I need to display while I click in left frame. ( Display in the sense, Assume section's 1 to 10 are visible in right screen. I click left frame link for 20th section, which is a label/static text in the right frame and it should be scrolled up in the screen ).
Just give the label a name: [HTML]<a name="#label">[/HTML] and link to it instead of trying to focus.
Aug 18 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Robert Dickow | last post: by
2 posts views Thread by your name here | last post: by
reply views Thread by Jason Rodman | last post: by
6 posts views Thread by Mike | last post: by
4 posts views Thread by Sandy.Pittendrigh | last post: by
10 posts views Thread by EA | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.