Hi all, I'm new to this forum and I am hoping that there is someone here who can help me.
I have an ASP page that has javascript that works perfectly in IE, but not in Firefox. Can anybody tell me how to get it to work in FF. I can insert a browser identifier and redirect if the script has to change for FF only.
Basically, when a vistor goes to the page they are asked to click on images to chose the top 3 that they like - the images changes colour (another image) when they click on it and changes back if they click again. All of the validation (that is in the script as well) works, but the clicking on the images to change does not work. The code is below: -
-
<script language="JavaScript">
-
<!--
-
function ButtonClick()
-
{
-
if (document.survey.clickcount.value > 0)
-
{
-
// drag drop result
-
var urlString = '';
-
// check button result
-
urlString = '';
-
for (idx=0; idx < 17; idx++)
-
{
-
document.getElementById('v' + (idx+1)).value = document.getElementById('Img' + (idx+1)).myclick;
-
}
-
}
-
else
-
{
-
if (document.survey.q23a.value == '' && document.survey.q23b.value == '' && document.survey.q23c.value == '')
-
{alert("Sorry, you must select or type at least one ");
-
return false}
-
}
-
}
-
-
function CheckClick(ctrl)
-
{
-
-
if (document.getElementById(ctrl.id).myclick == '2')
-
{
-
-
//New function start 18-Aug-2006
-
var txtcount = 0;
-
if (document.survey.q23a.value !="")
-
txtcount += 1;
-
if (document.survey.q23b.value !="")
-
txtcount += 1;
-
if (document.survey.q23c.value !="")
-
txtcount += 1;
-
if ((parseInt(document.survey.clickcount.value) + txtcount) >= 3)
-
{ alert("Sorry, you can only select or type three maximum ");
-
return false;}
-
//New function end 18-Aug-2006
-
//the following two lines are used to calculate number of clicks.
-
if (document.survey.clickcount.value >= 3){
-
//document.survey.clickcount.value=parseInt(document.survey.clickcount.value) + 1;
-
alert("Sorry, you can only select or type three maximum ");}
-
else{
-
document.getElementById(ctrl.id).myclick = '1';
-
document.getElementById(ctrl.id).src='images\\' + ctrl.id + '_on.gif';
-
document.survey.clickcount.value=parseInt(document.survey.clickcount.value) + 1;}
-
}
-
else if (document.getElementById(ctrl.id).myclick == '1')
-
{
-
document.survey.clickcount.value=parseInt(document.survey.clickcount.value) - 1;
-
document.getElementById(ctrl.id).myclick = '2';
-
document.getElementById(ctrl.id).src='images\\' + ctrl.id + '_off.gif';
-
}
-
}
-
-
function NewFun(txtv)
-
{
-
var txtcount = 0;
-
if (document.survey.q23a.value !="")
-
txtcount += 1;
-
if (document.survey.q23b.value !="")
-
txtcount += 1;
-
if (document.survey.q23c.value !="")
-
txtcount += 1;
-
if ((parseInt(document.survey.clickcount.value) + txtcount) > 3)
-
{ alert("Sorry, you can only select or type three maximum ");
-
document.getElementById(txtv.id).value = "";
-
return false;}
-
}
-
//-->
-
</script>
-
-
The elements on the page are (sorry, it is a lot):
-
-
<form name="survey" action="survey_23.asp" method="get">
-
<input type="hidden" name="clickcount" value=0>
-
<table width="700" height="423" border="0" align="center" cellpadding="0" cellspacing="0">
-
<tr>
-
<td width="700" height="371" valign="top" background="images/23_radio_bg.jpg">
-
<div id="DivCheckBox" style="Z-INDEX: 105; LEFT: 0px; WIDTH: 700px; POSITION: relative; TOP: 0px; HEIGHT: 72px">
-
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
-
<tr>
-
<td><div align="left"><img src="images/Img6_off.gif" width="69" height="35" hspace="5" border="0" align="center" id="Img6" onClick="CheckClick(this)" myclick="2"></div></td>
-
<td><img src="images/Img3_off.gif" width="76" height="37" border="0" id="Img3" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
<td> </td>
-
<td><img src="images/Img7_off.gif" width="68" height="34" border="0" align="right" id="Img7" onClick="CheckClick(this)" myclick="2"></td>
-
<td><img src="images/Img10_off.gif" width="120" height="38" hspace="13" border="0" align="right" id="Img10" onClick="CheckClick(this)" myclick="2"></td>
-
</tr>
-
<tr>
-
<td><img src="images/Img11_off.gif" width="79" height="43" border="0" id="Img11" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
<td><img src="images/Img2_off.gif" width="77" height="35" border="0" id="Img2" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
<td> </td>
-
<td> </td>
-
</tr>
-
<tr>
-
<td> </td>
-
<td><img src="images/Img1_off.gif" width="75" height="35" vspace="10" border="0" id="Img1" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
<td> </td>
-
<td valign="top"><img src="images/Img13_off.gif" width="81" height="37" border="0" id="Img13" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
</tr>
-
<tr>
-
<td><img src="images/Img15_off.gif" width="71" height="34" border="0" id="Img15" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
<td><img src="images/Img9_off.gif" width="68" height="34" border="0" id="Img9" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
<td> </td>
-
<td><div align="right"><img src="images/Img8_off.gif" width="75" height="37" border="0" align="right" id="Img8" onClick="CheckClick(this)" myclick="2"><img src="images/Img5_off.gif" width="92" height="41" vspace="7" border="0" align="right" id="Img5" onClick="CheckClick(this)" myclick="2"></div></td>
-
</tr>
-
<tr>
-
<td colspan="2"><img src="images/Img14_off.gif" width="123" height="37" border="0" id="Img14" onClick="CheckClick(this)" myclick="2"></td>
-
<td colspan="3" valign="top"><img src="images/Img12_off.gif" width="103" height="34" hspace="23" vspace="5" border="0" align="left" id="Img12" onClick="CheckClick(this)" myclick="2"></td>
-
<td align="right"><div align="right"><img src="images/Img17_off.gif" width="161" height="51" vspace="5" id="Img17" onClick="CheckClick(this)" myclick="2"></div></td>
-
</tr>
-
<tr>
-
<td> </td>
-
<td valign="bottom"><img src="images/Img16_off.gif" width="66" height="35" vspace="3" border="0" id="Img16" onClick="CheckClick(this)" myclick="2"></td>
-
<td colspan="3" valign="top"><img src="images/Img4_off.gif" width="122" height="40" border="0" id="Img4" onClick="CheckClick(this)" myclick="2"></td>
-
<td> </td>
-
</tr>
-
</table>
-
</div></td>
-
</tr>
-
<tr>
-
<td height="29" valign="middle" bgcolor="#3399CC"><table width="100%" height="16" border="0" cellpadding="0" cellspacing="0">
-
<tr>
-
<td width="322"><img src="images/text_top_radio.gif" width="322" height="16"></td>
-
<td width="120"><input name="q23a" type="text" class="input01" id="q23a" maxlength="99" value="" onKeyUp="return NewFun(this)"></td>
-
<td width="3"><img src="images/spacer.gif" width="2" height="1" border="0" value="" onKeyUp="return NewFun(this)"></td>
-
<td width="120"><input name="q23b" type="text" class="input01" id="q23b" maxlength="99" value="" onKeyUp="return NewFun(this)"></td>
-
<td width="3"><img src="images/spacer.gif" width="2" height="1" border="0"></td>
-
<td width="120"><input name="q23c" type="text" class="input01" id="q23c" maxlength="99" value="" onKeyUp="return NewFun(this)"></td>
-
<td width="12"><img src="images/spacer.gif" width="12" height="1" border="0"></td>
-
</tr>
-
</table></td>
-
</tr>
-
<tr>
-
<input type="hidden" name="RespID" value="<%=request("RespID")%>">
-
<input type="hidden" name="tribe" value="<%=request("tribe")%>">
-
<input type="hidden" name="v1">
-
<input type="hidden" name="v2">
-
<input type="hidden" name="v3">
-
<input type="hidden" name="v4">
-
<input type="hidden" name="v5">
-
<input type="hidden" name="v6">
-
<input type="hidden" name="v7">
-
<input type="hidden" name="v8">
-
<input type="hidden" name="v9">
-
<input type="hidden" name="v10">
-
<input type="hidden" name="v11">
-
<input type="hidden" name="v12">
-
<input type="hidden" name="v13">
-
<input type="hidden" name="v14">
-
<input type="hidden" name="v15">
-
<input type="hidden" name="v16">
-
<input type="hidden" name="v17">
-
<td height="23"><table width="700" height="23" border="0" cellpadding="0" cellspacing="0">
-
<tr>
-
<% if request("bp")="" then %>
-
<td width="56"><a href="survey_21.asp?bp=1&RespID=<%=request("RespID")%>&tribe=<%=request("tribe")%>" onMouseOver="MM_swapImage('backbut','','pbar/back02.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="pbar/back01.gif" alt="BACK ONE QUESTION" name="backbut" width="56" height="23" border="0" id="backbut"></a></td>
-
<% else %>
-
<td width="56"><img src="pbar/spacer.gif" name="backbut" width="56" height="23" border="0" id="backbut"></td>
-
<% end if %>
-
<td width="588"><img src="pbar/pbar09.gif" width="588" height="23"></td>
-
<td width="56"><input type="image" name="submit" value="NEXT" src="pbar/next01.gif" alt="NEXT QUESTION" width="56" height="23" border="0" id="submit" onMouseOver="MM_swapImage('submit','','pbar/next02.gif',1)" onMouseOut="MM_swapImgRestore()" onClick="return ButtonClick()"></td>
-
</tr>
-
</table></td>
-
</tr>
-
</table>
-
</form>
-
I would be grateful to anybody who can help me on this, as I have got out of my depth with this problem.
Thanks in advance.
Stewart
7 8915
I didn't take all the time to see all that code (in theory it should be a very simple few-line script with a short array and a toggle if/else block), but as you know your own code best - plus being a bit of a JS n00b myself, I just offer one hint: Check the Tools menu for the JavaScript Console. It will tell you everything causing errors in your script. If you visit pages with ads on them, you'd probably do good to Clear them first, though... lots of sloppy coders out there =)
Niheel 2,456
Recognized Expert Moderator Top Contributor
Code tags help other members read the code a bit better. They makie it easier to for readers (potential helpers) sort out the code from the explanation part.
I went ahead and made the changes for you.
Here are some instructions on using code tags: http://www.thescripts.com/forum/misc.php?do=bbcode#code
I didn't take all the time to see all that code (in theory it should be a very simple few-line script with a short array and a toggle if/else block), but as you know your own code best - plus being a bit of a JS n00b myself, I just offer one hint: Check the Tools menu for the JavaScript Console. It will tell you everything causing errors in your script. If you visit pages with ads on them, you'd probably do good to Clear them first, though... lots of sloppy coders out there =)
Thanks for the advice and I do apologise for the large amount of code I have pasted. I did say that this was the first time I had done this and I really did not know of any other way - I do now.
Anyway, I have checked the Javascript Console and it shows no errors. It simply does not work in FF. To check if my console was working OK, I inserted an error and it showed. When I corrected it, no errors. I cannot understand, as according to all the JS sites on the web, it should work in FF.
Thanks for your advice anyway.
Thank you KUB635 (administrator) . I feel suitably put down now. I did say that this was the first time I had ever done this and I was expecting a little help rather than a condescending critique of my posting.
Rest assured that, in the future, I will follow your advice in posting. However, maybe you could show me what you mean this time.
Niheel 2,456
Recognized Expert Moderator Top Contributor
Papelotte,
Sorry for the way it came out in writing, i see my error now. It was just suppose to be an instruction for people who would end up posting replies to your question.
Here are the instructions to posting code: http://www.thescripts.com/forum/misc.php?do=bbcode#code
If you have any questions, please feel free to PM me.
Thanks,
KUB
I think that I'm experiencing the same problem. I have the following image and form element: -
<img src="../../images/layout/noimage.jpg" id="pic16" name="pic16" style="height: 75px;">
-
<input type="file" name="imfiles[16]" id="imfiles[16]" class="txtinput" size="10" onChange="imUpdate(16);">
-
The javascript function changes the source of the image to whatever filename is selected in the input element: -
function imUpdate(_which)
-
{
-
_imID = "pic"+_which;
-
_elID="imfiles["+_which+"]";
-
_src=document.getElementById(_elID).value;
-
document.getElementById(_imID).src=_src;
-
}
-
-
This works in IE, but not FF. I'm hoping this is just a matter of scripting, and not some sort of security problem. I use similar code on the back ends of several websites.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: YZK |
last post by:
Hello. I'm not a Web developer, just a user, and I think I may have
somehow messed myself up majorly. I'm not quite sure how. Right now,
javascript used by websites I go to either does not work at all, or
works sporadically. I'm talking about things like Hotmail, Yahoo Address
Book, buttons on various sites, etc.. I'm a computer person, but...
|
by: Howard Kaikow |
last post by:
Yesterday, I decided to try Firefox. I've encountered a behavior that is
either a bug in Firefox or a bug in my Javascript code. I'll try to explain
the problem, hoping that this newsgroup can (in)validate my Javascript code.
First, I'll describe the purpose of the Javascript code.
I often have a need to post a URL to something at my own...
|
by: f1crazed |
last post by:
Ok, The following html works wonderful in IE. It does not work in
FireFox. Can someone please tell me the work around for FireFox to get
this to work.
HTML DOCUMENT:
<html>
<head>
<title>CSS Z-order Test</title>
<script language=Javascript>
|
by: Derek Erb |
last post by:
I am banging my head against the wall with this one. The following
code snippets work perfectly fine in MSIE6. But produce an error in
Firefox and do not work at all.
BROWSER.HTM
<HTML>
....
<div class="Abb">
<h2 id="ABTit">BROWSER</h2>
</div>
|
by: DKM |
last post by:
Here are the source code files to a Java applet that utilizes
LiveConnect to communicate with Javascript, and the HTML file.
The thing works both in IE 6.0 and FireFox 1.4. but with some problems.
IE crashes when one refreshes the page or leave the page. This happens
only after calling the Java method more than once. It does not crash if...
| |
by: rich_poppleton |
last post by:
Help....
I've got a textarea where people type in a description. However for
certain reasons we need to stop them typing !$*^ .
I have a solution this which works fine in IE:
function keypress()
{
|
by: lmarceglia |
last post by:
Hi,
I have this website that doesn't work in Firefox 1.5:
www.pianetaluca.com
The HTML source is:
<TITLE>PianetaLuca</TITLE>
</HEAD>
|
by: Olly |
last post by:
Hello Everyone!
Could someone please have a look at my JS Form I posted
below....Something wrong there, but I don't understand what's exactly.
Many thanks.
Olly
===============================
<script language="JavaScript">
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted
********************************************************
For this teeny job, please refer to:
http://feeds.reddit.com/feed/8fu/?o=25
|
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 on the same
page work correctly.
It appears to be isolated to 1-2 machines in a particular network. I
cannot verify whether these machines have...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |