IE7 not parsing variable in Javascript function

I have this simple Javascript function that works fine in IE8, FF and others, but not in IE7.

function changecss(theClass,element,value,sheet) { var cssRules; var added = false; var mySheet = document.styleSheets[sheet]; if (mySheet['rules']) { cssRules = 'rules'; } else if (mySheet['cssRules']) { cssRules = 'cssRules'; } else { //no rules found... browser unknown } //more code here }

IE7 fails on this line

var mySheet = document.styleSheets[sheet];

if I enter the value that I am trying to parse manually, the function works fine.

The function is called using a document ready function

<script type="text/javascript">$(document).ready(function() { var sz = parseFloat(ReadCookie("fs")); if (!isNaN(sz)) { changecss("div.panes","font-size",sz+"px",0); } }); </script>

Any idea what this means? i'm puzzled.

Category:javascript Views:0 Time:2011-10-06

Related post

  • How to pass csharp binding variable to Javascript function 2010-11-30

    I want to pass c# binding variable to javascript function. Here is my code: <asp:LinkButton ID="lbID" runat="server" Text="<%#Text%>" OnClientClick="passAccessory('<%#Bind(variable)%>'); "></asp:LinkButton> But it always gener

  • get ArrayList JSP variables in JavaScript function 2012-01-17

    I am trying to get familiar with javaScript and currently stumbled upon one issue: How to get ArrayList JSP variables in JavaScript function? Fo example I figured out how I can get an int value, but dont know how to move the array list var total='

  • passing multiple php variables into javascript function 2010-11-05

    This question already has an answer here: How to pass variables and data from PHP to JavaScript? 8 answers I'm trying to pass multiple values from PHP into my javascript function. The function is simple right now, just trying to show a popup with the

  • pass a c# variable to javascript function 2010-11-11

    I'm trying to pass a c# variable as an argument to a java-script function like <%var count=model.SomeMode.Count();%> when i pass it to my java script function "checkAll(count)" it does not fire but without the argument its workin fine <a hre

  • Delphi Web Automation How to pass THIS Variable to JavaScript function 2010-11-17

    HI, I am trying to automate a Combo Box selection and then Screen Scrape the results. But I have a problem firing the Combo Box Change event which is not called when simply changing the selection. The onchange event is set to a JavaScript Function: S

  • Including ListItem variables in JavaScript function call 2011-01-28

    I have a nested ListView (Master/Detail) and want to invoke a JavaScript function in the detail ItemTemplate so that this function can call a static method on the server site and post the field update. I need to include three data variables in the fu

  • increment php variable in javascript function 2011-03-16

    Can anyone tell me how to increment a php variable inside a javascript function.I have a javascript function which is called for every 3 seconds inside this function i need to increment the php variable. <? php $k =0?> function slide() { //incr

  • Pass javascript variable as javascript function parameter from HTML 2011-03-28

    I have a global javascript parameter declared at the top of my script: param2. I am calling my function on body load. I would like to pass my global javascript parameter to a javscript function. <script language="javascript"> var param2; ... fu

  • Passing PHP variable to javascript function with Geolocation and XMLHttpRequest function 2011-04-20

    I am basically trying to store the location of a user at the same time as when I store other information they provide. The location information, latitude and longitude, is provided by JavaScript from Google geolocation. So the issue here is how to me

  • pass php variables to javascript function error:missing ) after argument list 2011-08-04

    I try to use XMLHttpRequest() to post data to a url. I wrote the following javascript: function makePostRequest(url, params) { var httpRequest = new XMLHttpRequest();"POST", url, true); //Send the proper header information along wit

  • Pass dynamic variables to Javascript function? 2011-10-25

    This question already has an answer here: How to pass variables and data from PHP to JavaScript? 8 answers <?php if ($option['type'] == 'select') { ?> <div id="option-<?php echo $option['product_option_id']; ?>" class="option"> <

  • Passing PHP variable to Javascript function 2012-01-23

    This question already has an answer here: How to pass variables and data from PHP to JavaScript? 8 answers I am trying to pass a PHP variable to a Javascript function but it keeps displaying as 'undefined'. I have the Javascript on a separate page an

  • Pass PHP Variable to Javascript function from Button 2012-01-25

    Here's what I got. <script type="text/javascript"> function show_confirm(id) { var r=confirm("Are you sure you want to duplicate this record?"); if (r==true) { ("","mywindow"); } else { aler

  • variables when javascript function is used as the basis for a object - 2012-02-15

    What is the advantage of using "" rather than "name" in when a javascript function is used as the basis for a object - function cat(name) { = name; = function() { alert( + " says meeow!" ) alert( name + " says m

  • How to pass string variable to javascript function using php 2012-02-28

    I have a problem about to passing a string parameter to java-script function using PHP. I have an anchor tag as View Live. Here $website contains web URL. On click of link I am opening a popup window. and function to open popup I have a function popu

  • Passing a variable to javascript function from codebehind 2012-04-02

    i bascially want to get the value of a variable from the codebehind to use in a javascript function for is the function: $(document).ready(function() { $('.PONumbers').autocomplete( { source: function(request, response) { $.ajax(

  • Loading PHP variable in Javascript function 2012-04-03

    Edit: Entire page (HTML) <!doctype html> <html> <head> <meta charset="utf-8" /> <title>jQuery Ajax Test</title> <script type="text/javascript" src="jquery_1.6.1.js"></script> <script type="text/javas

  • override variable in javascript function 2014-03-12

    Firstly I want to say that I was searching some information about scope variables in javascript (e.g JavaScript Variable Scope) and I was trying to understand why my code behaves like that but finally I really don't know. I can't override var a in my

  • Send a variable to javascript function from jquery 2011-11-20

    I have a jquery mouseover event which succesfully calls a javascript function $(document).ready(function() { $('.nw').mouseover(run_nw); }); function run_nw() { ... } However, when I try to pass parameters, the js fails. $(document).ready(function()

Copyright (C), All Rights Reserved.

processed in 0.143 (s). 11 q(s)