<script language="javascript" type="text/javascript"> v_0=0; function adjustTotal(src, dest, pr) { var price = parseFloat(pr); alert("t " + src); // document.getElementById('<%=TextBox1.ClientID%>').value = "some value"; obj1.innerText =document.getElementById(src).value; //getElementsByName(src); alert("obj1 " + obj1.innerText); //var obj2 = document.getElementsByName(dest); var obj2=document.getElementById('<%=lblprice.ClientID%>').value; // document.getElementById(). alert("obj2 " + obj2.innerText); // originObj = document.getElementById('origin'); // destinObj = document.getElementById('destin'); // document.getElementById(src).value = obj1.value; // document.getElementById(dest).value = obj2.value; if (obj1 != null && obj2 != null)//&& !isNaN(price)) { //make sure user has entered a number, else it is 0. var v = 0; if (obj1.value != "" )//&& !isNaN(parseInt(obj1.value))) v = parseInt(obj1.value)*price; var t = parseFloat(obj2.innerText); v_0 = v_0 * price; var total = t+v-v_0; obj2.innerText; obj2.innerText = total.toFixed(2); alert(obj2.innerText); } } //} /* src - the id with the textbox to record the initial value of */ function adjustInit(src) { var obj1 = document.getElementById(src); if (obj1 != null ) { if (obj1.value != "" )//&& !isNaN(parseInt(obj1.value))) v_0 = parseInt(obj1.value); else v_0 = 0; } } </script> PHP: document.getElementById aint working in Firefox/Safari. Can somebody please help. Additional Updates: Its working in IE though
How are you passing the id? btw, the <script> tag should look like this: <script type="application/javascript"> http://www.ietf.org/rfc/rfc4329.txt
The usual cause of this problem is when the parameter passed is actually a name attribute instead of an id. Since you haven't shown the element, it's not possible to tell.