473,513 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Working around IE7s prompt bug

7 New Member
Hi all!

I'm very appreciative that someone have come out with such a method to go around IE7's prompt bug as shown in the below link, but I don't really know how to use it.

http://www.hunlock.com/blogs/Working...ug,_er_feature

This is what I did and the bottom one is my original section of my javascript code, but I think I use it wrongly.


Expand|Select|Wrap|Line Numbers
  1. <script type='text/javascript' src='IEprompt.js'></script>
  2. <script type='text/javascript'>
  3.  
  4. function promptCallback("") {
  5.  
  6.     alert("Enter the number of Lucky Dip Chances you want to buy.");
  7.  
  8.  location='<?=tep_href_link(FILENAME_LUCKY_DIP, '', 'SSL')?>';
  9.  
  10.   } else { 
  11.     location="luckydip.php?osCsid=<?=$_GET['osCsid']?>&action=purchase&qty=" + number;
  12.   }
  13.  
  14. IEprompt("How many Lucky Dip Chances you want to buy?.", "");
  15. </script>
  16.  


Original::

Expand|Select|Wrap|Line Numbers
  1. <script> 
  2.  
  3. function main() {
  4.  
  5.   var input  = prompt("How many Lucky Dip Chances you want to buy?.", "");
  6.  
  7.   var number = input;
  8.  
  9.    if(number == "") {
  10.  
  11.     alert("Enter the number of Lucky Dip Chances you want to buy.");
  12.  
  13.  location='<?=tep_href_link(FILENAME_LUCKY_DIP, '', 'SSL')?>';
  14.  
  15.   } else { 
  16.     location="luckydip.php?osCsid=<?=$_GET['osCsid']?>&action=purchase&qty=" + number;
  17.   }
  18.  
  19.  }
  20.  
  21. </script>
  22.  
  23.  
I just started learning javascript, so I'm sorry that I don't understand the terminology. Sorry about that. This is previously how I link to the front page, upon using yout script, can we retain the link: <a href="javascript:main()"> ?

Thank you so much!

Warmest Regards,
Gordon
Dec 11 '07 #1
9 2085
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

Try:
Expand|Select|Wrap|Line Numbers
  1. function promptCallback(number) {
  2.  if (number == "") {
  3.     alert("Enter the number of Lucky Dip Chances you want to buy.");
  4.  
  5.    location='<?=tep_href_link(FILENAME_LUCKY_DIP, '', 'SSL')?>';
  6.  
  7.   } else { 
  8.     location="luckydip.php?osCsid=<?=$_GET['osCsid']?>&action=purchase&qty=" + number;
  9.   }
  10. }
  11. IEprompt("How many Lucky Dip Chances you want to buy?.", "");
  12.  
Dec 12 '07 #2
nanakse85
7 New Member
Hi there, Thank you so much for your help, but the page just refresh and there were no effects.

I've changed it to :

Expand|Select|Wrap|Line Numbers
  1. <script type='text/javascript' src='IEprompt.js'></script>
  2. <script type='text/javascript'>
  3.  
  4. function promptCallback(number) {
  5.  
  6.    if(number == "") {
  7.  
  8.     alert("Enter the number of Lucky Dip Chances you want to buy.");
  9.  
  10.     location='<?=tep_href_link(FILENAME_LUCKY_DIP, '', 'SSL')?>';
  11.  
  12.   } 
  13.  
  14. else { 
  15.     location="luckydip.php?osCsid=<?=$_GET['osCsid']?>&action=purchase&qty=" + number;
  16.   }
  17.  
  18. IEprompt("How many Lucky Dip Chances you want to buy?.", "");
  19.  
  20.  }
  21.  
  22. </script>
  23.  
This time round i can see the IE7 prompt to go around the problem of IE7's prompt bug for javascript. However, it just blink once and I was not able to type in any values.

Is it because the way I link which may create problems too like what i did below?

[HTML]<td width="50%" align="center"><b><a href="javascript:promptCallback()">Click here to buy 1 Lucky Dip Chance for <?=getCostPerLuckyDip()?> PV</a><br>Note: Lucky dip chances are not refundable for PVs.</b></td>
[/HTML]
Thank you so much for your help, sorry for my "newbie" skills.
Dec 12 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Is it because the way I link which may create problems too like what i did below?

[HTML]<td width="50%" align="center"><b><a href="javascript:promptCallback()">Click here to buy 1 Lucky Dip Chance for <?=getCostPerLuckyDip()?> PV</a><br>Note: Lucky dip chances are not refundable for PVs.</b></td>
[/HTML]
You need to call IEPrompt, not promptCallback.
Dec 13 '07 #4
nanakse85
7 New Member
Yup it works, but however the first prompt was undefined, the sentence I type in IE prompt came out in a blink after i enter any value.

Thanks once again!
Dec 14 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
What does your full code look like now?
Dec 14 '07 #6
nanakse85
7 New Member
What does your full code look like now?
i separate into 2 parts as in between there are other codings:

Expand|Select|Wrap|Line Numbers
  1.       <script type='text/javascript' src='IEprompt.js'></script>
  2.       <script type='text/javascript'>
  3.  
  4.       function promptCallback(number) {
  5.  
  6.          if(number == "") {
  7.  
  8.           alert("Enter the number of Lucky Dip Chances you want to buy.");
  9.  
  10.           location='<?=tep_href_link(FILENAME_LUCKY_DIP, '', 'SSL')?>';
  11.  
  12.         }
  13.  
  14.       else {
  15.  
  16. location="luckydip.php?osCsid=<?=$_GET['osCsid']?>&action=purchase&qty=" + number;
  17.  
  18.         }
  19.  
  20.       IEprompt("How many Lucky Dip Chances you want to buy?.", "");
  21.  
  22.        }
  23.  
  24.       </script>
  25.  
The second part where the javascript is called in is:

[HTML]<form action="luckydip.php?action=bid&osCsid=<?=$_GET['osCsid']?>" method="post">
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#1484d2">
<tr>
<td>
<table border="0" width="100%" cellspacing="1" cellpadding="3" class="luckyDipContents">
<tr>
<td width="50%" align="center"><b>Your Lucky Dip Chances:</b> <?=getNumChances($_SESSION['customer_email_address'])?></td>
<td width="50%" align="center"><b><a href="javascript:main()">Click here to buy 1 Lucky Dip Chance for <?=getCostPerLuckyDip()?> PV</a><br>Note: Lucky dip chances are not refundable for PVs.</b></td>
</tr>[/HTML]

Hope this will be clearer in assessing the error.
Dec 19 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
Change main() to:
Expand|Select|Wrap|Line Numbers
  1. function main() {
  2. IEprompt("How many Lucky Dip Chances you want to buy?.", "");
promptCallback should get called automatically.
Dec 20 '07 #8
nanakse85
7 New Member
Change main() to:
Expand|Select|Wrap|Line Numbers
  1. function main() {
  2. IEprompt("How many Lucky Dip Chances you want to buy?.", "");
promptCallback should get called automatically.

Thank you so much man!!! It works perfectly. hehe. I'm trying on other stuff, i'll ask around for help if needed. This community rocks!!!
Dec 23 '07 #9
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. Glad it helped.
Dec 23 '07 #10

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

Similar topics

8
1991
by: lawrence | last post by:
I'm a beginner with Javascript and especially cross-browser Javascript. I got this working in IE, but not in Netscape 7. It seems like, in Netscape, every time I click on a button, the focus shifts...
1
2034
by: sea | last post by:
I have administration client installed on one computer and the full version of db2 installed on the server -- this is DB2 7.2 workgroup edition, fixpak 7. On the server I can go to the command...
5
1292
by: Rog | last post by:
Hello, I went to http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnaspp/html/aspnet- usingtreeviewiewebcontrol.asp and saved down the TreeviewControl.msi file and also...
1
1702
by: Rog | last post by:
Hello, Yesterday I downloaded IEwebcontrols.exe and TreeviewControl.msi from http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnaspp/html/aspnet-...
13
10687
by: joemac | last post by:
I'm just starting out with javascript and the following is not working as it should. The expected prompt dialog box never appears. <head> <script language="JavaScript"><!-- var name;...
4
3673
by: Jeff | last post by:
I feel like I should have been able to figure this out but I can't seem to find any references on this topic. It seems like my current working directory is consistently a few directories up from...
7
1861
by: Dabbler | last post by:
My gridview Delete command works until I install a confirm prompt as follows, then it does nothing. Any suggestions would be appreciated! protected void MyGridView_RowCreated( object sender,...
7
5146
by: Ja NE | last post by:
(as first - thank you for all your help several years ago, and second - please apologise me for my clumsy enlgish) so, preface: some users on my photo related site sometimes enter (link) giant...
1
1362
gregerly
by: gregerly | last post by:
Hello All, I'm a PHP programmer pretending to be a python programmer right now. I'm playing around with the interactive prompt via putty on my server and am getting the hang of the syntax and...
0
7264
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
7386
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
7543
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...
1
7106
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...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.