Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox Javascript Errors

Status
Not open for further replies.

sirian

MIS
Oct 7, 2006
2
US
Hello Everyone,

I have problem. Who would a thunk it.....a person in a forum and having a problem, HOW UNIQUE???!!!! Anyways, seriousley...I do.

I am building a web page and trying to use the javascript onchange event to call a few javascript functions to play a flash movie, submit a form and change the property on a page. The way it is set up it works in IE, but not in Firefox. Can anyone tell me why and more importantly help me find a specific solution.

Basically the form has three differnt select menus that are dynamically populated with a some PHP code. When they change values the on change event fires in EI, but not in Firefox. For reference, below I have first posted the javascript functions and then the actual form elements in right after..........Any and all help or suggestions will be greatley apprecaited

<script type="text/javascript">
<!--

function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText)); document.close();}
else innerHTML = unescape(newText);
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
}
}

function submitit(form1){
var form = document.form1;
form.submit();

}

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function MM_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
var obj=MM_findObj(objStr);
if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
}
//-->
</script>


<form id="form1" method="post" action="selectdate.php">
<noscript>
</noscript>
<span id="Layer1" style="position:absolute; width:650px; height:150px; z-index:4; left: 200px; top: 352px;">
<div id="lyrAdv" style="position:absolute; width:150px; height:14px; z-index:1; left: 52px; top: 50px;">
<select name="select" id="select" onChange="MM_showHideLayers('lyrLoc','','show','lyrDate','','show');MM_controlShockwave('EatNose','','Play')">
<option value="">SELECT ADVENTURE</option>
<?php
do {
?>
<option value="<?php echo $row_rsGetAdvName['advID']?>"><?php echo $row_rsGetAdvName['advName']?></option>
<?php
} while ($row_rsGetAdvName = mysql_fetch_assoc($rsGetAdvName));
$rows = mysql_num_rows($rsGetAdvName);
if($rows > 0) {
mysql_data_seek($rsGetAdvName, 0);
$row_rsGetAdvName = mysql_fetch_assoc($rsGetAdvName);
}
?>
</select>
</div>
<div id="lyrLoc" style="position:absolute; width:150px; height:24px; z-index:2; left: 252px; top: 50px; visibility: visible;">
<select name="lstlocations" id="lstlocations" onChange="MM_changeProp('form1','','action','selectdate.php','FORM');form1.submit()" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rsGetlocationsByAdv" wdg:displayfield="LocName" wdg:valuefield="LocName" wdg:fkey="AdvID" wdg:triggerobject="select">
<option value="-1">SELECT LOCATION</option>
</select>
</div>
<div id="lyrDate" style="position:absolute; width:150px; height:13px; z-index:3; left: 450px; top: 50px; visibility: visible;">
<select name="lstDates" id="lstDates" onChange="MM_changeProp('form1','','action','selectLocation.php','FORM');form1.submit()" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rsGetDatesByAdv" wdg:displayfield="dates" wdg:valuefield="dates" wdg:fkey="AdvID" wdg:triggerobject="select">
<option value="-1">SELECT DATE</option>
</select>
</div>
<div id="Layer2" style="position:absolute; width:100px; height:49px; z-index:5; left: 250px; top: 100px;">
<noscript><input name="Submit" type="submit" value="SUBMIT LOCATION"></noscript>
</div>
<div id="Layer3" style="position:absolute; width:100px; height:48px; z-index:5; left: 450px; top: 100px;">
<noscript>
<input name="Submit" type="submit" value="SUBMIT DATE">
</noscript>
</div>
</span>

</form>
 
Have a rough look at the handler only. Inside MM_showHideLayers(), the third line:

[tt]if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v=='hide')?'hidden':v; }[/tt]

I doubt there is not much chance to be correct. Whether it is the source of the problem, I have absolutely no idea and not interested in knowing. It should be at least something like this?

[tt]if (obj.style) { obj=obj.style; v=(v=='show')?'visible'[highlight]:([/highlight]v=='hide')?'hidden':v; }[/tt]

They try to produce optim and/or general script, they may have just produced some monster... probably I'm not using it and not familiar with it. (In any case, from the look of it, they do not want people, and at least deter people, to editing it. So it's your call.)
 
the Firefox Javascript console says:

Error obj.Play is not a function on Line 86

it also says

Error: form1 is not defined

Basically all of the Javascript behavoirs are prebuilt behaviors that came with Dreamweaver MX

These are the two functions that are on or around line 86

function MM_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText)); document.close();}
else innerHTML = unescape(newText);
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
}
}
 
><form id="form1" method="post" action="selectdate.php">
[tt]<form [red]name[/red]="form1" method="post" action="selectdate.php">[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top