473,385 Members | 1,814 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 cannot get Firefox to execute this code:

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2. <!--
  3.  
  4.  
  5. function enterCheck(b){
  6.     if(b=="PASSWORD")
  7.         {
  8.             window.open("http://hhrlifestyle.org/hello.htm")
  9.  
  10.         }
  11.                 else alert("The password is not correct.");
  12.     }
  13.  
  14. //-->
  15.  
  16.  
  17.  
  18. </script>
  19.  
Jul 12 '10 #1
7 1759
gits
5,390 Expert Mod 4TB
how do you call the function?
Jul 13 '10 #2
Dormilich
8,658 Expert Mod 8TB
as far as I know, the second parameter in window.open() (the new window’s name) cannot be omitted.
Jul 13 '10 #3
@gits
Expand|Select|Wrap|Line Numbers
  1. <input type=password name=code1 size=15>
  2. <input type=button  value="ENTER" onClick="enterCheck(code1.value)"></p>
It works fine in Internet Explorer, not in Firefox.
Jul 13 '10 #4
gits
5,390 Expert Mod 4TB
Expand|Select|Wrap|Line Numbers
  1. enterCheck(code1.value)
is wrong ... you might use the following, which retrieves the node and its value correctly:

Expand|Select|Wrap|Line Numbers
  1. <input type="password" name="code1" id="foo" size=15>
  2. <input type="button" value="ENTER" onclick="enterCheck(document.getElementById('foo').value)">
basically you should even enclose attribute values in double quotes.
Jul 13 '10 #5
THANK YOU! PROBLEM SOLVED! Looks like I better brush up on my JavaScript calls.
Jul 13 '10 #6
gits
5,390 Expert Mod 4TB
the problem comes from developing in IE first - which often leads to non standards-compliant scripts that will be broken in all other browsers. it is much more to prefer to develop with FF or Chromium/Chrome - and then fix the much more less IE issues that should occur in the end. the other way round it is often required to fix a lot for standards-compliant browsers ...
Jul 14 '10 #7
acoder
16,027 Expert Mod 8TB
From what I gather, this script is probably an exercise/tutorial. However, if and when you develop for real, don't use JavaScript to test for passwords. Anyone can quite easily check the source code.
Jul 14 '10 #8

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

Similar topics

2
by: Ken Allen | last post by:
I have a service that was developed in C# that I wish to debug. The project resides on my desktop system and I wish it to execute on a remote test system (actually on the next desk). When I...
1
by: hahoyer | last post by:
My solution (C#) contains binary references to .NET Framework components. The sources for those components are available. But it seems that these sources are not reachable by DevStudio: I cannot...
1
by: neo1981 | last post by:
I want to execute code which is in a string variable like if i have a string like str='import xyz' then I want to execute import xyz in my program. Is there any way to do this ? :confused:
4
by: mynameistechno | last post by:
I need to execute code in an onload event. e.g. eval(element.getAttribute('onload')); This works in Firefox but not in IE (surprise!). IE's getAttribute for the onload event seems to return an...
4
by: gautam89 | last post by:
Hi everyone, I wanted to know if there is a way to execute code that is inside a string variable. If anyone know, please help as I am new to Java. Thanks..
8
by: shrik | last post by:
I have one main page which contains two iframes say 'leftpanel' and 'content'. leftpanel contain page which has tree in it. Now whenever i clikc on the partiucular node the pages in the 'content'...
2
by: =?Utf-8?B?RnJlZW1hbg==?= | last post by:
Hi, I'm new to vb.net. How to prevent vb.net to automatic execute code in design time? When I open a form design view in VS2005, vs pop up an error message: "Could not load file or assembly...
22
by: giordan | last post by:
Hi all! I've wrote this code: <script type="text/javascript"> var largImg; var altImg; var txtTop = '<b>Ottima scelta!</b> Ora compila il form e premi "Ricevi banner". Il...
2
by: maya | last post by:
hi, I keep getting this error, "can't execute code from a freed script" when I go to another page (i.e., upon UNLOAD..) this error occurs only in IE, not FF (what a surprise.....;) what is...
2
by: gsherp | last post by:
How does one execute code when the user closes the browers window by clicking on the top right corner . I need to log out user and do a database write when the user closes the brower. I do these to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.