Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: frames problem

  1. #1
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default frames problem

    hi to all,

    using one program i devided my webpage into two parts. in one of two frames i have a text field. new my question is while loading this page my cursor must and shoud present on text field. is it possible, if possible tell me. i am waiting for you people's reply.

    regards

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Without specifics, I'm not sure exactly what needs to happen, but a link to your page would be helpful.

    Using javascript, onLoad (in the body tag) can set the focus to a certain element. Can't remember the exact code at the moment, though.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Place the below mentioned code in the onload event of body of the required page.
    Code:
    document.forms[the_form_index].textbox_field_name.focus();
    for example: document.forms[0].tb.focus() will focus the cursor on the text box whose name is tb which is in the first form of the document.

  4. #4
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for your reply

    but sorry to say i am not getting the exact output. it may be becose my program only thats why i am posting myu code. please go through once and tell where i am doing mistakes

    mycode is as follows

    test.html
    --------
    Code:
    <html>
    	<head>
    		<script language="javascript">
    		function tes()
    		{
    			document.forms[0].t1.focus();
    		}
    		function tep()
    		{
    			window.alert("hello");
    			document.forms['f1'].elements['b1'].onClick = function() {tes()}
    		}
    		</script>
    	</head>
    	<body>
    		<form name="f1" onload="tes()">
    		 <input type="text" name="t1">
    		 </form>
    	</body>
    </html>
    i am waiting for your reply

    regards

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Try this one

    Code:
    <html>
    	<head>
    		<script language="javascript">
    		function tes()
    		{
    			document.forms[0].t1.focus();
    		}
    		function tep()
    		{
    			window.alert("hello");
    			document.forms['f1'].elements['b1'].onClick = function() {tes()}
    		}
    		</script>
    	</head>
    	<body onload="tes()">
    		<form name="f1" >
    		 <input type="text" name="t1">
    		 </form>
    	</body>
    </html>

  6. #6
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes it is working


    thanks for your help

    now i want to ask another Q related to this only. how to use this one in frames.

    regards

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    In frames? In what way? Do you want to focus on something in a frame?
    - Mike

  8. #8
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for your reply


    it is working for frames(upto my requirement). now i want to ask about frames but different one as follows:

    in my project there are 4 forms all are having same fields but on that same form there are four operations are there. they are namely "Insert(it is by default), Update, Delete and Select.

    first i developed seperate forms for seperate operations, i worked on that and i understood that i am unnecessarily rewriting code. thats why i am planning to use same form for different operations. but here all operations are different, calling functions are different, different properties.

    now my problem is how to change all those properties while pressing the relevent button.

    can you guide me how to achive this

    regards

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    how to change all those properties while pressing the relevent button.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <script type="text/javascript">
    function change() {
      for (var i=0;i<arguments.length;i=i+2) arguments[i].value = arguments[i+1];
      }
    </script>
    </head>
    <body>
    <form name="myForm">
    	Insert: <input type="text" name="insert">
    	<br>Update: <input type="text" name="update">
    	<br>Delete: <input type="text" name="sdelete">
    	<br>Select: <input type="text" name="select">
    	<br><input type="button" value="Change" onclick="
    		var a=document.forms['myForm'];
    		change(a.insert,'new insert',
    			a.update,'new update',
    			a.sdelete,'new delete',
    			a.select,'new select')">
    </form>
    </body>
    </html>
    The function change() is as follows:
    Every 1st argument is the element you want to apply to new text to, every 2nd argument is the text to be applied to the previous element, using the .value attribute.
    - Mike

  10. #10
    Join Date
    Apr 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default want to change properties dynamically

    hi to all

    i am developing a page using jsp and in that i am using script language as javascript. in that page i i have four text boxes and 4 buttons and required records are getting from database using jsp

    operations of buttons are "Insert","Update","Delete","Exit". by default it is in Insert Mode. now any one can insert after filling all the details and press "Insert" button. Upto here there is no problem for me. it is working very well.

    when ever i want to update my records i am facing problems. inorder to update my details press "Update" button. when ever i press "Update" button it automatically. i am waiting for you peoples replys


    regarding

Bookmarks

Posting Permissions

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