473,385 Members | 1,848 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,385 software developers and data experts.

I have javascript code which run successfully on firefox but not on internet Explorer

1
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.  
  4. <script type="text/javascript">
  5. var element;
  6. function test(){  
  7.         abc = document.getElementById('promptbox').value;
  8.         document.forms['form0'].elements[element].value = abc; 
  9.         return true;
  10.  
  11. function prompt() {
  12.     el = document.getElementById("prompt");
  13.     el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
  14. }
  15.  
  16.         <!--
  17.         function callPrompt(elementID){
  18.             element = elementID;
  19.             prompt2('btn1p.gif', 'My Prompt','Please enter your information', 'myfunction');
  20.                         prompt();
  21.         }
  22.         //-->
  23.  
  24.         var response = null 
  25.  
  26.             function prompt2(promptpicture, prompttitle, message, sendto) {
  27.                 promptbox = document.createElement('div');
  28.                 promptbox.setAttribute ('id' , 'prompt') 
  29.                     document.getElementsByTagName('body')[0].appendChild(promptbox) 
  30.                     promptbox = eval("document.getElementById('prompt').style") 
  31.                     promptbox.position = 'fixed' 
  32.                     promptbox.top = '150px' 
  33.                     promptbox.left = 0 
  34.                     promptbox.border = 'outset 1 #bbbbbb'  
  35.  
  36.                     document.getElementById('prompt').innerHTML = document.getElementById('prompt').innerHTML + "<table cellspacing='0' cellpadding='5' border='5' width='400px' height='400px' class='promptbox' align='center' bgcolor='#ededed'><tr><td align='center'><table><tr><td><br>" + message + "</td></tr><tr><td align='center'><input type='text' value='' name='promptbox' id='promptbox' onblur='this.focus()' class='promptbox' align='center'></td></tr><tr><td align='right'><br><input type='button' class='prompt' value='OK' onMouseOver='this.style.border=\"1 outset #dddddd\"' onMouseOut='this.style.border=\"1 solid transparent\"' onClick='prompt();test();'> <input type='button' class='prompt' value='Cancel' onMouseOver='this.style.border=\"1 outset transparent\"' onMouseOut='this.style.border=\"1 solid transparent\"' onClick='" + sendto + "(\"\"); document.getElementsByTagName(\"body\")[0].removeChild(document.getElementById(\"prompt\"))'></td></tr></table></td></tr></table>" 
  37.  
  38.                     document.getElementById("promptbox").focus() 
  39.                 } 
  40.  
  41.         function myfunction(value) { 
  42.  
  43.             if(value.length<=0)
  44.                 return false;
  45.             else
  46.                 document.getElementById('output').innerHTML="<b>"+value+"</b>";
  47.         }
  48. </script>
  49.  
  50. <style type="text/css">
  51. #prompt {
  52.      visibility: hidden;
  53.      position: absolute;
  54.      left: 0px;
  55.      top: 0px;
  56.      width:100%;
  57.      height:100%;
  58.      text-align:center;
  59.      z-index: 100;
  60. }
  61.  
  62. #prompt div {
  63.      width:300px;
  64.      margin: 100px auto;
  65.      background-color: #fff;
  66.      border:1px solid #000;
  67.      padding:15px;
  68.      text-align:center;
  69. }
  70.  
  71. body {
  72.      height:100%;
  73.      margin:0;
  74.      padding:0;
  75. }
  76. </style>
  77.  
  78. </head> 
  79. <body>  
  80. <form name="form0"><br><br><br><br> 
  81. <table align="center" width="500"><tr><td>
  82. Click on a textbox and dialog will appear, The issue is I want each textbox individualized so when the dialog info is entered, its inputted into the correct textbox. I need the dialog to recognize which textbox was clicked thru iteration as there may be hundreds of textboxes.
  83. </td></tr></table>
  84.  
  85. <p align="center">
  86. input1 <input type="text" name="input" id="input1" size ="30" onClick="callPrompt(this.id);"><br><br>
  87. input2 <input type="text" name="input" id="input2" size ="30" onClick="callPrompt(this.id);"><br><br>
  88. input3 <input type="text" name="input" id="input3" size ="30" onClick="callPrompt(this.id);"><br>
  89. And so on.....<br><br></p>
  90.  
  91. <table align="center" width="500"><tr><td align="left">
  92. Example:<br>
  93. I click on textbox "input1".....dialog appears,<br>
  94. I enter "Hello World!".....Then click "Ok",<br>
  95. textbox "input1" is filled in with "Hello World!"<br>
  96. <br>
  97. I click on textbox "input2".....dialog appears,<br>
  98. I enter "Hello World again!".....Then click "Ok",<br>
  99. textbox "input2" is filled in with "Hello World again!"<br>
  100. <br>
  101. I click on textbox "input3".....dialog appears,<br>
  102. I enter "and again Hello World!".....Then click "Ok",<br>
  103. textbox "input3" is filled in with "and again Hello World!"<br>
  104. And so on.....
  105. </td></tr></table> 
  106. </form>
  107.  
  108. </body>
  109. </html>
Sep 23 '08 #1
1 1364
acoder
16,027 Expert Mod 8TB
What doesn't work? What exactly do you expect it to do and what happens instead?
Sep 23 '08 #2

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

Similar topics

26
by: Patient Guy | last post by:
Has anyone written code that successfully manipulates binary file data using Javascript? It might---and in the case of doing I/O, will---make use of browser- specific functions (ActiveX/COM with...
11
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
8
by: Matt Kruse | last post by:
http://news.zdnet.com/2100-1009_22-6121608.html Hackers claim zero-day flaw in Firefox 09 / 30 / 06 | By Joris Evers SAN DIEGO--The open-source Firefox Web browser is critically flawed in...
3
by: google | last post by:
I am trying to complete a javascript application and am having problems with code similar to that show below. Much testing has shown that Firefox finishes the code shown in around 0.25 secs but...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
21
by: TonyV | last post by:
Hi all, I'm trying to use some javascript code in Internet Explorer 6.0 that's being generated by a Perl file. I have a line in my header that looks something like this: <script...
26
by: Prisoner at War | last post by:
Hi, All: I have a JavaScript search engine that always causes MSIE 7 to do a top-of-page security "warning" (that top-of-page-bar, and not an "alert" )...but other websites' JavaScripts do not...
1
by: rameshk_tvm | last post by:
Hi, I have created a web page with javascript, its successfully working in firefox but not in internet explorer version 6 and 7. I am not good in scripting and I have done this page with the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.