I'm currently modifying a php controlled website and wish to distinguish between javascript and non-javascript browsers in order to decide which pages to display. I have a single php controller script which "includes" a number of html pages. I want to ensure that I cater for both javascript and non-javascript browsers (so functionality is the same, only the javascript pages have a far better look and feel to them).
Therefore I would like to code something along the lines of :
Code: if (javascript_browser=='true') { include './javascript_page1.html.php'; exit();
Do we have any alternative for orientation attribute of Td element in javascript for firefox? Below code works fine in IE but throws undefined in firefox:
I have a problem with FireFox. I have written a function to Add rows without submiting the form. This function works fine in IE, but not in FireFox. The function is :
function createRows(deviceId,deviceType,modelName,ipAddress,macAddress,imageURL) { oTable=document.getElementById("tab:tabForm: oTable");
var oRow1=oTable.insertRow(oTable.rows.length); var aRows=oTable.rows; var aCells=oRow1.cells; var oCell1_1=aRows(oRow1.rowIndex).insertCell(aCells.length); var oCell1_2=aRows(oRow1.rowIndex).insertCell(aCells.length); var oCell1_3=aRows(oRow1.rowIndex).insertCell(aCells.length); var oCell1_4=aRows(oRow1.rowIndex).insertCell(aCells.length); var oCell1_5=aRows(oRow1.rowIndex).insertCell(aCells.length); var oCell1_6=aRows(oRow1.rowIndex).insertCell(aCells.length);
I have completed the necessary function and it does not need any changes however from the "alert" I need there has to be double quotes surrounding the search 'Lboro'. (I know I may be making a meal of the coding however the lecturer wants us to follow this due to everyone being at different levels of programming). I have used the '' character however the double quotes do not end up in the position I require them?!
My Coding function findAnyU (s){ var a = s , b , c , d , e = -1; for (var i = 0 ; i < pages.length && e == -1 ; i++){ b = pages[i].indexOf('['); c = pages[i].indexOf(']'); d = pages[i].substring(b+1, c).toLowerCase(); e = d.indexOf(s.toLowerCase()); }
if(e >= 1) a += ' found' else a += ' not found' return (a) } alert (findAnyU('Lboro' , pages)); Current Alert = Lboro found
I wrote a program which showing the difference of two auto generated values. its working perfectly but when i tried to set if() operator to make sound if the difference higher then 7 its not working.
I think something wrong in my code.
Orginal working code here...
But when i put if() operator under processdata() function the whole things hanged and no sound are palying.
I applied it like this way.
I dont know why its not working....i want to play and stop sound name sample.wav from my harddrive if difference range higher or lower than 7.....
I have these two functions used from Jquery i am looking for a alternative for them in javascript as i need to completely remove the jquery from the same code...
I'm making a Google Map that reads info from a database and pulls Twitter usernames from it to plot points on a map. In the infowindow of these points I have some code that displays the Twitter users latest tweet. There's alot of code for this map so i'll only show you the part i'm working on, which is the read database part:
Code: function readData() { var request = GXmlHttp.create();
for (var i = 1; i < 5; i++) var pl = eval("player" + i) var namepl = eval("document.charInput.name" + i + ".value");
[code]....
In the case of the 2nd-4th player, it changes to name2.value, etc.Based on these three inputs, I need to iterate through all four players and make the player object for each of them, as I've done above.
i am new to AJAX but i havejust managed to write one of my first basic scripts. What it does is takes all the news items out of a database and lists them as links. When you click a link i want all of the data that is linked to that news item to display underneath. Now i have got this to work except it will not work in Firefox, all other browsers it is fine.
Now I want to apply the parent of tabContent a width, only if a condition is true. I do this, and works, but I don't consider this is a proper way: tabContent.css('width', '0') .css('opacity', '0') .filter(':eq(0)') .css('opacity', '1') .parent() .each(function() { if (/*condition is true*/) { $(this).width(aWidth + 'px'); } $(this).find('.one-tab') .addClass('active') .css('cursor', 'default'); }); Is there a better way instead of using each() which is actually made for loops? In this case there is only one element.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> [Code]....
alerts the innerHTML content in all the browsers. Except in Firefox 3.6.8, which alerts a blank value. What the f?:confused: I know that innerHTML is not a standard DOM method, but it used to be a crossbrowser one since FF 1.5, right? Edit: It does not work even in case of firstChild.nodeValue or firstChild.data. FF 3.6.8 says that the DIV element has no first child, which is amazing.
I recently made a simple tool that opens a website in an iFrame and tells the user how long the page took to load. I made it out of a premade stopwatch
When i run the test in most browsers (Chrome, Firefox 3.6 and older, IE) it works fine with the output textbox going from "Please run the test" to "Test Running" to [TIME TAKEN FOR PAGE TO LOAD] but in firefox 3.7 (Minefield) it goes from "Please run the test" to "0" every time and the page in the iFrame doesn't load.
I've read that Firefox 3.7 has a new Javascript Engine
The test is at [URL] and the problem code is on THIS PAGE (Use View Source in your browser)
If you write javascript:document.forms[0].submit(); in the location bar, automatically it submits the form, which bypass the form validation. It there any trick to block this form submit?
I was looking for a way to have a popup window appear when someone left my page, but not have it appear when they hit the refresh or back buttons on the browser. Since using onUnload="..." in the body tag causes the window to appear when you hit the refresh or back buttons, that didn't do what I wanted.
After doing Google searches for many days I never did find an answer for how to do this. I thought I could have each page open the popup onUnload, but then also have each page close the window onLoad, so the window only stays visible if you actually exit from my whole website. The problem is, I didn't have the handle to the window object in the page that wanted to close the window. I tried passing the handle in a cookie, but that didn't work either.
My solution, which I haven't seen anywhere else before, works like this:
Every page (they are php) includes the same header which has this code in it:
var exit = true; <?php $popstuff = file_get_contents("_popstuff.txt"); $values = explode("|",$popstuff); $usepop = $values[0]; if ($usepop!="on") { echo("exit = false; "); // turn off popup window } ?> function offerWindow() { if ( exit ) { offerPop=window.open('_offer.php', 'offer','width=425,height=298,resizable=0,toolbar= 0,location=0,directories=0,status=0,menubar=0,scro llbars=0'); offerPop.blur(); window.focus(); } } function noExit() { exit = false; } function closeOffer() { offerPop=window.open('_offer.php', 'offer','width=0,height=0,resizable=0,toolbar=0,lo cation=0,directories=0,status=0,menubar=0,scrollba rs=0'); offerPop.close(); } // End --> </script> </head> <body onUnload="offerWindow();" onLoad="closeOffer();">
Now what happens is if you leave the page it opens the popup, but before you even get to see it, the next page closes it (by window name instead of by handle). If you close the browser, or leave the whole web page then the popup remains. If there is a path you wish to take out of the site that does not show the popup then just include onClick="noExit()" to the link and it turns off the popup. Normally the links that go from page to page within the website will all include the "noExit()" call so the popup never even shows up. But the problem where the popup shows up on browser refresh or back buttons just goes away.
Today I've tried to create simple hover effect on a <div>: if the cursor is over the box, the background-image css property of the div is modified. On the HTML side, a <div> with an id:
JQuery and have a problem with an expandable menu I have created for a new Wordpress theme.
With my expandable menu I am simply (slide)toggling the children <ul> by clicking the parent <li>. This should work fine but jQuery is overiding the default event for the anchors in the children resulting in me having a nice expandable menu that animates well but with its links disabled.
As far as I can tell this should work as I am targeting one level of anchor beneath the parent and not any other more deeply nested children.
The problem only applies to the followning browsers - Firefox 3.5, Safari 4, Chrome and ie 8.
It works fine in ie 6 and 7, Firefox 3 and Opera 9.
The jQuery is as follows:
The html structure is as follows:
I left the anchor details (href, title and so on) out just to make the html code a little easier to scan.
My problem is that ive made some code for when the user clicks on a button, it will load 2 different pages into 2 separate frames, however it only seems to work when the website is viewed in IE, not firefox or mozilla etc
My two frames are main and main2
The button to return the user to the home page, has the code: onclick="homeload()"
and i have a javascript function as below in the head of my document: <script language="JavaScript"> <!-- function homeload() { parent.document.getElementById("main1").src="home.htm" parent.document.getElementById("main2").src="home2.htm" } // --> </script>
Any idea how i can make this compatible with mulitple browsers?
I have the following function that display a list depending on the drop down option the user selects but doesnt not work on explorer it works on other browsers but on exploere i get the following error code...