473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Show DHTML popup window in front of frames/enable disabled/read-only text box

Hi All,

I have some problem in innerHtml. I have the textbox in innerHtml, In the innerHtml textbox was read only. I want make it to enable. if user enter the text that text will be retrieved, so i want to be enable text box. Another one problem is the the innerhtml will be in like popup window. it will automatically closed.i want be whenever i click close button that time only it will close. Please help me.

here is the Code


[HTML]<html>

<body>
<script type="text/javascript">
function show_popup23()
{

var p=window.createPopup();
var pbody=p.document.body;
//pbody.style.filter="alpha(opacity=100)" ;
pbody.style.fontSize="10px";
pbody.style.align="center";
pbody.style.fontFamily="Verdana, Arial, Helvetica, sans-serif";
pbody.document.body.innerHTML=oToolTip.innerHTML;
p.show(0,0,800,500,document.body);

}
</script>

<a onClick="show_popup23()">Click Me</a>
<div id="oToolTip" style="display:none; ">
<div id="block" style=" vertical-align:middle; width:100%; height:100%; border:2px solid black; filter:progid:DXImageTransform.Microsoft.Gradient( GradientType=0, StartColorStr=#cdcdcd, EndColorStr=#FFFFFF); padding:0px">

<table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0" bordercolor="000000" align="center" class="txttype1" >
<tr bgcolor="#9B9AB7"><td colspan="4" height="1px"></td></tr>

<tr><td align="center" valign="middle">
<table class="txttype1" border="0" bordercolor="#000000" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#9B9AB7" width="1px"></td>
<td height="22px" width="150px"><font size="1px" face="Verdana, Arial, Helvetica, sans-serif">Headeing</font></td>
<td align="right"><a onclick="pbody.hide()"><img src="images/close.gif"></a></td>
<td bgcolor="#9B9AB7" width="1px"></td>
</tr>
<tr>
<td bgcolor="#9B9AB7" width="1px"></td>
<td bgcolor="#ffffff" height="25px"><font size="1px" face="Verdana, Arial, Helvetica, sans-serif">Enter the Name</font></td>
<td bgcolor="#ffffff"><input type="text" class="textbox" name="name" value="sadas" /> </td>
<td bgcolor="#9B9AB7" width="1px"></td></tr>
<tr>
<td bgcolor="#9B9AB7" width="1px"></td>
<td bgcolor="#ffffff" colspan="2" align="center" height="40px"><input type="submit" value="Done" name="done" ><input type="reset" value="Clear" name="clear" > </td>
<td bgcolor="#9B9AB7" width="1px"></td>
</tr>
<tr bgcolor="#9B9AB7"><td colspan="4" height="1px"></td></tr>
</table>
</td></tr>
</table>
</div>
</div>
</body></html>[/HTML]
Jul 14 '08 #1
12 8636
hsriat
1,654 Expert 1GB
What is createPopup? Either you need to define this function, or you would need to use window.open instead. And same goes for show.

And you can't refer to oToolTip like this. You need to add this statement to your code:
Expand|Select|Wrap|Line Numbers
  1. var oToolTip = document.getElementById('oToolTip');
Jul 14 '08 #2
acoder
16,027 Expert Mod 8TB
I would add that the alternative to createPopup() would be a DHTML popup window. Although those suggestions may not answer your question directly, they will help you out in the long run. You're coding only for one browser using proprietary code which will not work in any other browser. Get out of that habit as soon as possible as the other browsers are taking a larger share of the market year in year out.

Re. your question: I can't see the text box as being read-only in your code.

PS. please use code tags when posting code.
Jul 14 '08 #3
What is createPopup? Either you need to define this function, or you would need to use window.open instead. And same goes for show.

And you can't refer to oToolTip like this. You need to add this statement to your code:
Expand|Select|Wrap|Line Numbers
  1. var oToolTip = document.getElementById('oToolTip');

Hi i dont want to window.open because it will display close,min and disable max button on title bar i dont want to like that. i have morethen 8 frame in a page so i want top of the frame(over the frame). i used like that, in the case the problem is if i click outside the popup it automatically closed.i want to whenever i click the close button that time only it closed. please help me.

Did you know div tag over the frame. it is possible. If u know means tell me how to do that.

Thanks
Jul 15 '08 #4
hsriat
1,654 Expert 1GB
Hi i dont want to window.open because it will display close,min and disable max button on title bar i dont want to like that. i have morethen 8 frame in a page so i want top of the frame(over the frame). i used like that, in the case the problem is if i click outside the popup it automatically closed.i want to whenever i click the close button that time only it closed. please help me.

Did you know div tag over the frame. it is possible. If u know means tell me how to do that.

Thanks
Then use a DHTML popup script like lightbox or thickbox. Just google for either of them and see what you get.
Jul 15 '08 #5
Then use a DHTML popup script like lightbox or thickbox. Just google for either of them and see what you get.
No yar. I cant use gray box, light box and thick box. In this window have 2 fields only. so i want simple. if you know the div tag over the frame. please tell me how to do that. that is very help full for me.

Thanks yar.
Jul 15 '08 #6
hsriat
1,654 Expert 1GB
No yar. I cant use gray box, light box and thick box. In this window have 2 fields only. so i want simple. if you know the div tag over the frame. please tell me how to do that. that is very help full for me.

Thanks yar.
Then you create a popup div. The CSS that is required for a popup div are as follows:
Expand|Select|Wrap|Line Numbers
  1. #popup_div {
  2.     position: fixed; /* (or absolute) */
  3.     left: 0px;
  4.     top: 200px;
  5.     height: 200px;
  6.     width: 400px;
  7.     display: none;
  8.     z-index: 200;
  9.     background-color: #fff;
  10. }
And make you popUp() function like:
Expand|Select|Wrap|Line Numbers
  1. function popUp(txt) {
  2.     var popup = document.getElementById('popup_div');
  3.     popup.innerHTML = txt;
  4.     popup.style.left = (parseInt(screen.availWidth) - 400) /2 + 'px';
  5.     popup.style.display = 'block';
  6. }
Jul 15 '08 #7
Then you create a popup div. The CSS that is required for a popup div are as follows:
Expand|Select|Wrap|Line Numbers
  1. #popup_div {
  2.     position: fixed; /* (or absolute) */
  3.     left: 0px;
  4.     top: 200px;
  5.     height: 200px;
  6.     width: 400px;
  7.     display: none;
  8.     z-index: 200;
  9.     background-color: #fff;
  10. }
And make you popUp() function like:
Expand|Select|Wrap|Line Numbers
  1. function popUp(txt) {
  2.     var popup = document.getElementById('popup_div');
  3.     popup.innerHTML = txt;
  4.     popup.style.left = (parseInt(screen.availWidth) - 400) /2 + 'px';
  5.     popup.style.display = 'block';
  6. }
Thanks hsriat for your effort but i think u miss understood my query , let me explain my query !! i have an application running in 8 frames, what i require is on click of a button in say frame3 i need a div tag to be windowed like modal dialog box so that the user can enter some inputs , i can't use a modal dialog box. so if you could tell me how is it possible to show a div over all frames in the center of I.E it would be great !! many a thanks again for your replys
Jul 15 '08 #8
hsriat
1,654 Expert 1GB
Didn't the above code work?
Jul 15 '08 #9
Didn't the above code work?
No yar. i tried but i will work in the that frame only. I want like this

Expand|Select|Wrap|Line Numbers
  1.  ----------------------------------------
  2.  |                                             |
  3.  |           Upper frame                |
  4.  |                                             |
  5.  |           -------------------               |
  6.  |          |      DIV          |             |
  7.  ---------     Middle frame   -----------|
  8.  |         |                       |             |
  9.  |         --------------------                 |
  10.  |                                              |
  11.  |          Lower frame                  |
  12.  |                                             |
  13.  ----------------------------------------------
  14.  
In this div will appear in three frame (upper, Middle and Lower frame). I want to like this.

Thanks yar
Jul 15 '08 #10
acoder
16,027 Expert Mod 8TB
For modal dialogs, you could use showModalDialog if you know that your clients use IE, Firefox 3 and the latest versions of Safari. Opera and Firefox2- don't support it.

For a more cross-browser solution, show the DHTML div from the frameset, i.e. using top to get to the parent. For a modal effect, use a transparent layer which doesn't allow the user to interact with the rest of the content until they close the popup div. To give you an idea, see this link.
Jul 15 '08 #11
hsriat
1,654 Expert 1GB
No yar. i tried but i will work in the that frame only. I want like this
In this div will appear in three frame (upper, Middle and Lower frame). I want to like this.

Thanks yar
Well Well, I see that div is not being created in the frameset, even if created for window.top.document. And if created from within a frame, it takes references of that frame as position coordinates.

So here, if possible you can create it from the middle frame. Do you consider it as an option?
For a more cross-browser solution, show the DHTML div from the frameset, i.e. using top to get to the parent. For a modal effect, use a transparent layer which doesn't allow the user to interact with the rest of the content until they close the popup div. To give you an idea, see this link.
[html]<html>
<head>
<script type="text/javascript">
window.onload = function () {
var bt = document.getElementsByTagName('button')[0];
bt.onclick = function () {
var p = window.top.document.createElement('div');
//p.className = 'popup_div';
//p.id = 'popup_div';
p.innerHTML = 'Name:<br /><input type="text" name="name" /><br />Surname:<br /><input type="text" name="surname">';
//p.style.left = (parseInt(screen.availWidth) - 400) /2 + 'px';
//p.style.display = 'block';
try {
window.top.document.getElementById('top_frameset') .appendChild(p); //not working
//alert(window.top.document.getElementById('top_fram eset').id) //working
}
catch (e) {alert(e);}
//not showing any error
//neither is firebug showing any
//but the web development tool bar's CSS error icon is turning red
//Error console says nothing.
}
}
</script>
</head>
<body>
<div>
<h1>Page 3</h1>
<button>Show PopUp</button>
</div>
</body>
</html>[/html]This is the code of one of the three frames but isn't working.

PS: I think the title should be changed.
Jul 15 '08 #12
acoder
16,027 Expert Mod 8TB
I have changed the title.

I hadn't tested the concept of using a DHTML div popup in a frameset (I don't like frames anyway), it was an idea. I would avoid frames and either use iframes or load the external content in divs dynamically using DHTML or Ajax.
Jul 16 '08 #13

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

Similar topics

4
by: KS | last post by:
Is it possible to write a javascript that makes a popup window when someone click on buttons/href on my page and close itself when the new page is about to get loaded? I want to prevent the user...
4
by: gallery | last post by:
My client is asking that once a viewer visits his website, the onLoad popup window not show up again. What's the best way to do this? Thanks, Marje
17
by: Applebrownbetty | last post by:
Hi, I'd like to append/amend the following code from the Dreamweaver extension "Open Picture Window Fever" for the ability to center the PopUp window: By default, it allows the window to be...
10
by: Thad | last post by:
Any javascript I could try on this? I've got a popup window on my site with the browser chrome removed. Another site's gone ahead and done a popup to my same .html page. The visitor to that site...
26
by: Raffi | last post by:
Hi, We have a database application that runs in a popup Internet Explorer application window. The reason for this is to isolate the casual user from the address bar and the typical IE navigation...
9
by: Jimmy Junatas | last post by:
When we open a window (using client-side jscript ie. window.open("/Site/Popup.aspx?...",...)) from Page1.aspx, the called page Popup.aspx does not have access to the Session variables present in...
4
by: Sam Learner | last post by:
Hi Everyone, I'd like to create my own Internet Popup windows Stopping program. Is there any code I could you to monitor when IE or Netscape opens a Windows from a clicked Link? how about managed...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
2
by: KC | last post by:
Hi, Every JavaScript executive context has a top-level window and we can use window.open() to open another window ... Does this related to Windows created by click on "File"->"New Window" or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.