Page 1 of 1
Ah HELP! Javascript
Posted: Fri May 16, 2008 4:04 pm
by newbie2php
Code: Select all
<script type="text/javascript"><!--
var rowCount = 0;
//add a new row to the table
function addRow()
{
//add a row to the rows collection and get a reference to the newly added row
var newRow = document.getElementById("custom-plan").insertRow();
rowCount ++;
var oCell = newRow.insertCell();
oCell.innerHTML = (I have some PHP echo'd out here which all works fine - just too much code to copy out)
}
//deletes the specified row from the table
function removeRow(src)
{
var oRow = src.parentElement.parentElement;
//once the row reference is obtained, delete it passing in its rowIndex
document.getElementById("custom-plan").deleteRow(oRow.rowIndex);
}
The above code (abit messy I know!) works perfectly fine in I.E - but not so in firefox, here is a message I get (if this is the correct one for this javascript...)
Error: uncaught exception: Permission denied to call method Location.toString
I am unsure why the above code does not work, I am totally new to javascript and the above code is alot of copy and pasting. Is there anythig that springs out that may not be functional on firefox?
Re: Ah HELP! Javascript
Posted: Sat May 17, 2008 1:16 pm
by suresh_2220
if you are posting code, please align it and post .
Re: Ah HELP! Javascript
Posted: Sat May 17, 2008 1:28 pm
by newbie2php
Hi - thanks...
The code is hopefully now layed out nicer.
There is obviously more code on the page, but its not relevent. I think its just the javascript commands that are not liked in firefox, and I was hoping that someone would be able to spot if anything looks out of place and may be causing this issue. Works fine in I.E
Thanks alot
Re: Ah HELP! Javascript
Posted: Sat May 17, 2008 3:16 pm
by Eran
Methods insertRow() and deleteRow() are missing from your code, and Location.toString() is not called in what you've provided so it's hard to tell. Going by the error message, you have probably encountered a browser security measure that is enforced by Firefox but not by IE (so many of those floating around...).
I suggest you might try a Javascript library (I highly recommend jQuery -
http://www.jquery.com) and enjoy the expertise and thousands of hours of development for cross-browser compliance that were invested in those projects.