JavaScript - Getting Data Only Runs Once
A minor modification to the http://smoothiecharts.org/ example.
line2.append(new Date().getTime(), Math.random()); becomes line2.append(new Date().getTime(), updist()); var x = 0; function updist() { x = ("<?PHP phpread() ?>"); return (x); } <?php function phpread() { $t=$x=$y=$z=0; $fd = fopen ("/tmp/seis", "r"); // /tmp/seis is a single line that changes 20/sec $foo = fscanf ($fd, "%s", &$t); fclose($fd); $i = explode (",", $t); echo "$i[2]"; // should go: 2 7 9 4 0 -1 -8 -4 -5 2....... instead I get 2 2 2 2 2 2 2 2 } ?> ---------------- So "line2.append..." calls updist which calls phpread which works fine - once. It's as if the phpread caches the results of the read and never rereads the file. I'm snowed. Thanks Chuck Similar TutorialsEagle eyes needed! I have a function which is called twice. It allows the elements of an array to be set to a different color, successively: Code: function ln8 (arrayA,color,current) { var arrayB=(typeof arrayA == 'string')? arrayA.split(',') : arrayA; var line = document.getElementById(arrayB[current]); line.style.color = color; if (current != arrayB.length - 1) { current++; setTimeout(function() {ln8(arrayB, color, current)},8) } } It works fine the first call; the second time, FF throws an error message: 'line is null' referring to 'line.style.color = color;'. It's used in a switch function, and I've tested each case of the switch, two browsers, and still get the error. So I'm assuming the second call is the problem, but I just can't see what's wrong with it. Maybe before you wade through the code, can you think of other reasons for the error? First call: the function is at the third line of each case: Code: function makeLine5() { var a = Coin1() var b = Coin2() var c = Coin3() var h = ( a + b + c ) A=a;B=b;C=c;D=h; switch(h) { case 6: noHex2(5,'D'); noHex(Hex5Yang,'hidden',0); nodot(5, 4, 'e'); setTimeout('report5()',3000); setTimeout('ln8(Line5Yin,\'#e11\',0)',6000); setTimeout('dot(5, 4, \'f\')',10000); return false; break case 7: noHex2(5,'D'); noHex(Hex5Yin,'hidden',0); setTimeout('report5()',3000); setTimeout('ln8(Line5Yang,\'#e11\',0)',6000); return false; break case 8: noHex2(5,'C'); noHex(Hex5Yang,'hidden',0); setTimeout('report5()',3000); setTimeout('ln8(Line5Yin,\'#e11\',0)',6000); return false; break default: noHex2(5,'C'); noHex(Hex5Yin,'hidden',0);nodot(5, 4, 'f'); setTimeout('report5()',3000); setTimeout('ln8(Line5Yang,\'#e11\',0)',6000); setTimeout('dot(5, 4, \'e\')',10000); return false; } } second call: Code: function makeLine6() { var a = Coin1() var b = Coin2() var c = Coin3() var k = ( a + b + c ) A=a;B=b;C=c;D=k; switch(k) { case 6: noHex2(6,'D'); noHex(Hex6Yang,'hidden',0);nodot(6, 5, 'e'); setTimeout('report6()',3000); setTimeout('ln8(Line6Yin,\'#e11\')',6000); setTimeout('dot(6, 5, \'f\')',10000); setTimeout('lastBitz()',13000); return false; break case 7: noHex2(6,'D'); noHex(Hex6Yin,'hidden',0); setTimeout('report6()',3000); setTimeout('ln8(Line6Yang,\'#e11\')',6000); setTimeout('lastBitz()',13000); return false; break case 8: noHex2(6,'C'); noHex(Hex6Yang,'hidden',0); setTimeout('report6()',3000); setTimeout('ln8(Line6Yin,\'#e11\')',6000); setTimeout('lastBitz()',13000); return false; break default: noHex2(6,'C'); noHex(Hex6Yin,'hidden',0);nodot(6, 5, 'f'); setTimeout('report6()',3000); setTimeout('ln8(Line6Yang,\'#e11\')',6000); setTimeout('dot(6, 5, \'e\')',10000); setTimeout('lastBitz()',13000); return false;} } Hello, I'm attempting to use a jQuery tooltip (Tipsy, located here) in the index of a forum. What I'd like to do is remove the forum's description and place it in a pop-up when you hover over the forum name. I've managed to get it to work, but only on the very first forum name. After that, they simply display the default browser tooltip. Here is the script code that goes in the header: Code: <script type='text/javascript'> jQuery.noConflict(); jQuery(function() { jQuery('#tooltip').tipsy({gravity: 's'}); }); </script> Here is the part of the template that is affected: Code: <h4> <a href="{parse url="showforum={$forum_data['id']}" seotitle="{$forum_data['name_seo']}" template="showforum" base="public"}" id='tooltip' title='{$forum_data['description']}'>{$forum_data['name']}</a> </h4> And the Tipsy library can be viewed he http://www.xasper.net/jquery.tipsy.js Does anyone know what could get this to work? I appreciate any assistance. Thank you. $(function() { // HIDING THE CLASS $(".ad-nav").css("opacity","0.0"); // ON MOUSE OVER $(".ad-nav").hover(function () { // SET OPACITY TO 100% $(this).stop().animate({ opacity: 1.0 }, "slow"); }, // ON MOUSE OUT function () { // SET OPACITY BACK TO HIDE $(this).stop().animate({ opacity: 0.0 }, "slow"); }); }); I am hiding a Div and showing it on mouse over. Fade Animation is smooth on Safari but a bit choppy FF. Can anyone come up with a solution to make it run smoothly on both? thanks. Hi, I have a div "bigPicture" which contains an image of Thai food. Image can change based on a users onclick of thumbnails. Each image as it passes through div "bigPicture" needs to have the values: price, description and Date,Time associated with it. How do I assign those values and use them later in a Shopping Cart environment. I have tried getelementbyId.innerHTML using alert to see what I can get but it is too much information. website address is http://www.kohchangbookingandinforma.../ATT/index.asp Thanks for your consideration Robby I am working on a simple movie database to practise my JavaScript and have encountered difficulty extracting information from the xml file. Let me explain my scenario. Sorry if it gets a bit long-winded! The interface I have created has three columns which each serve the following functions: Column 1 -> The user selects a film of their choice. Column 2 -> Once the user has selected a film in Column 1 then more information about the film appears in this column. This includes title, director and cast. The user has the option of then selecting a cast member to find out information about them. Column 3 -> Once the user has selected a cast member in Column 2 then their name and a picture of them appears in this column (using the <img> tag). This information in this column also includes the film title, film artwork (applied <img> tag). But the difficulty I have encountered is as follows - I have a rough idea of how to update column 2 in real time to reflect the changes in Column 1. The method I am using for acquiring the relevant information in Column 2 is creating an array then using the indexOf to retrieve a the details of a specific film. I know this method is wrong and it would be better to pull the relevant information from the xml file. How do I use the idx from the Column 1 selection to pull out the relevant information to put in Column 2 and 3? Here is what I've done so far: Code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function XMLload() { jQuery.post(url, function(data) {getxml(data)}, 'xml'); } function dataFromTag(node, t) { var d = node.getElementsByTagName(t); if (d.length == 0) return (''); return (d[0].firstChild.nodeValue); } jQuery(document).ready(function() {XMLload();}); var url = 'movie.xml'; var xmlMovies; var aryMovieList = []; var xmlActors; var aryActors = []; var iframeOpen = '<html><head><\/head><body>' var iframeClose = '<\/select><\/form><\/body><\/html>' function getxml(xmldoc) { xmlMovies = xmldoc.getElementsByTagName('movie'); var hstr = iframeOpen; hstr += '<select size="' + xmlMovies.length + '" onchange="parent.actors(this.selectedIndex);">'; for (var MovieID = 0; MovieID < xmlMovies.length; MovieID++) { aryMovieList[aryMovieList.length] = dataFromTag(xmlMovies[MovieID], "title"); xmlActors = xmlMovies[MovieID].getElementsByTagName("actor"); for (var ActorID = 0; ActorID < xmlActors.length; ActorID++) { aryActors[aryActors.length] = dataFromTag(xmlMovies[MovieID], "director") + "/" + dataFromTag(xmlMovies[MovieID], "title") + "/" + dataFromTag(xmlActors[ActorID], "name"); } hstr += '<option>' + aryMovieList[MovieID] + '<\/option>'; } hstr += iframeClose; // test for aryMovieList // alert(aryMovieList); // test for aryActors // alert(aryActors); with(document.getElementById('movies').contentDocument) { open(); write(hstr); close(); } } function actors(idx) { var hstr = iframeOpen; var selectActor = []; hstr += 'title: ' + dataFromTag(xmlMovies[idx], 'title'); hstr += '<br>'; hstr += 'director: ' + dataFromTag(xmlMovies[idx], 'director'); hstr += '<br>'; for (var i = 0; i < aryActors.length; i++) { var aryActorList = aryActors[i].indexOf(dataFromTag(xmlMovies[idx], 'director') + '/' + dataFromTag(xmlMovies[idx], 'title')); if (aryActorList >= 0) { selectActor[selectActor.length] = i; } } // alert(selectActor); hstr += '<select size="' + selectActor.length + '" onchange="parent.info(this.selectedIndex);">'; for (var i = 0; i < aryActors.length; i++) { var aryActorList = aryActors[i].indexOf(dataFromTag(xmlMovies[idx], 'director') + '/' + dataFromTag(xmlMovies[idx], 'title')); if (aryActorList >= 0) { hstr += '<option>' + aryActors[i].substring(aryActors[i].lastIndexOf("/") + 1) + '<\/option>'; } } hstr += iframeClose; with(document.getElementById('actors').contentDocument) { open(); write(hstr); close(); } } function info(idx) { var hstr = iframeOpen; hstr += ''; hstr += iframeClose; with(document.getElementById('info').contentDocument) { open(); write(hstr); close(); } } </script> </head> Here is the XML file in use: Code: <movies> <movie> <title>Match Point</title> <director>Woody Allen</director> <image>Match-Point.jpg</image> <actor> <name>Scarlett Johansson</name> <image>Scarlett-Johansson.jpg</image> </actor> <actor> <name>Brian Cox</name> <image>Brian-Cox.jpg</image> </actor> <actor> <name>Matthew Goode</name> <image>Matthew-Goode.jpg</image> </actor> <actor> <name>Penelope Wilton</name> <image>Penelope-Wilton.jpg</image> </actor> </movie> <movie> <title>Inception</title> <director>Christopher Nolan</director> <artwork>Inception.jpg</artwork> <actor> <name>Leonardo DiCaprio</name> <image>Leonardo-DiCaprio.jpg</image> </actor> <actor> <name>Ken Watanabe</name> <image>Ken-Watanabe.jpg</image> </actor> <actor> <name>Joseph Gordon-Levitt</name> <image>Joseph-Gordon-Levitt.jpg</image> </actor> <actor> <name>Marion Cotillard</name> <image>Marion-Cotillard.jpg</image> </actor> <actor> <name>Ellen Page</name> <image>Ellen-Page.jpg</image> </actor> <actor> <name>Tom Hardy</name> <image>Tom-Hardy.jpg</image> </actor> </movie> <movie> <title>Blade II</title> <director>Guillermo del Toro</director> <artwork>Blade-II.jpg</artwork> <actor> <name>Wesley Snipes</name> <image>Wesley-Snipes.jpg</image> </actor> <actor> <name>Kris Kristofferson</name> <image>Kris-Kristofferson.jpg</image> </actor> <actor> <name>Ron Perlman</name> <image>Ron-Perlman.jpg</image> </actor> <actor> <name>Leonor Varela</name> <image>Leonor-Varela.jpg</image> </actor> <actor> <name>Norman Reedus</name> <image>Norman-Reedus.jpg</image> </actor> </movie> <movie> <title>Pulp Fiction</title> <director>Quentin Tarantino</director> <artwork>Pulp-Fiction.jpg</artwork> <actor> <name>John Travolta</name> <image>John-Travolta.jpg</image> </actor> <actor> <name>Samuel L Jackson</name> <image>Samuel-L-Jackson.jpg</image> </actor> <actor> <name>Uma Thurman</name> <image>Uma-Thurman.jpg</image> </actor> <actor> <name>Harvey Keitel</name> <image>Harvey-Keitel.jpg</image> </actor> </movie> <movie> <title>Avatar</title> <director>James Cameron</director> <artwork>Avatar.jpg</artwork> <actor> <name>Sam Worthington</name> <image>Sam-Worthington.jpg</image> </actor> <actor> <name>Zoe Saldana</name> <image>Zoe-Saldana.jpg</image> </actor> <actor> <name>Stephen Lang</name> <image>Stephen-Lang.jpg</image> </actor> <actor> <name>Michelle Rodriguez</name> <image>Michelle-Rodriguez.jpg</image> </actor> </movie> </movies> Many thanks in advance! Hello, Im new to JavaScript and this forum, right now im looking for a simple JS script, that will get the data out from the url and print it on my webpage: http://www.asecurecart.net/server/ca...report=1&xml=1 I think it should looks like this: Mypage.htm Code: < Some JavaScript Code Im looking for> <html> Your shopping cart: <br> Items: <script type="text/JavaScript"><!--document.write(item_total)//--> </script> <br> Order Total: <script type="text/JavaScript"><!--document.write(order_total)//--> </script> </html> Any help would be very appreciated. Thanks. Hi, I would like to use the following chart in my webpage http://people.iola.dk/olau/flot/examples/visitors.html the data being used in the chart example above looks like this: [1196722800000, 77], [1196809200000, 3636], [1196895600000, 3575], ... I guess that the long number is the date?! The data I have is: a date that is coming from my database which was added using the date(); object and a numerical figure such as 21.365 or 30.432 or 36.856 here is my code below currently in a list format (HTML): Code: <script type="text/javascript" charset="utf-8"> var html5rocks = {}; html5rocks.webdb = {}; html5rocks.webdb.db = null; html5rocks.webdb.open = function() { var dbSize = 10 * 1024 * 1024; // 10MB html5rocks.webdb.db = openDatabase("Todo", "1.0", "Todo manager", dbSize); } html5rocks.webdb.createTable = function() { var db = html5rocks.webdb.db; db.transaction(function(tx) { tx.executeSql("ALTER TABLE bmical ADD bmires INTEGER"); tx.executeSql("CREATE TABLE IF NOT EXISTS bmical(ID INTEGER PRIMARY KEY ASC, height1 TEXT, weight1 TEXT, bmires TEXT, added_on DATETIME)", []); }); } html5rocks.webdb.addTodo = function(todoText) { var db = html5rocks.webdb.db; db.transaction(function(tx){ var weight1 = document.getElementById("weight1").value; var height2 = todoText / 100 var BMI = weight1 / (height2 * height2) var BMI = BMI; var bmires = BMI.toFixed(3); var addedOn = new Date(); tx.executeSql("INSERT INTO bmical(height1, weight1, bmires, added_on) VALUES (?,?,?,?)", [todoText, weight1, bmires, addedOn], html5rocks.webdb.onSuccess, html5rocks.webdb.onError); }); } html5rocks.webdb.onError = function(tx, e) { alert("There has been an error: " + e.message); } html5rocks.webdb.onSuccess = function(tx, r) { // re-render the data. html5rocks.webdb.getAllTodoItems(loadTodoItems); } html5rocks.webdb.getAllTodoItems = function(renderFunc) { var db = html5rocks.webdb.db; db.transaction(function(tx) { tx.executeSql("SELECT * FROM bmical ORDER BY added_on DESC", [], renderFunc, html5rocks.webdb.onError); }); } html5rocks.webdb.deleteTodo = function(id) { var db = html5rocks.webdb.db; db.transaction(function(tx){ tx.executeSql("DELETE FROM bmical WHERE ID=?", [id], html5rocks.webdb.onSuccess, html5rocks.webdb.onError); }); } function loadTodoItems(tx, rs) { var rowOutput = ""; var todoItems = document.getElementById("todoItems"); for (var i=0; i < rs.rows.length; i++) { rowOutput += renderTodo(rs.rows.item(i)); } todoItems.innerHTML = rowOutput; } function renderTodo(row) { return "<li>On: " + row.added_on + " Height: " + row.height1 + " Weight: " + row.weight1 + " BMI: " + row.bmires + "<a class='delete' href='javascript:void(0);' onclick='html5rocks.webdb.deleteTodo(" + row.ID +");'>Delete</a></li>"; } function init() { html5rocks.webdb.open(); html5rocks.webdb.createTable(); html5rocks.webdb.getAllTodoItems(loadTodoItems); } function addTodo() { var height1 = document.getElementById("height1"); html5rocks.webdb.addTodo(height1.value); height1.value = ""; } </script> the 2 variables I'd like to use a bmires, addedOn need help.... I need to create a web page that can pull data from sensatronics senturion sensor probe. The unit has a web server that displays temperature, humidity,etc. You can also query it for from telnet or webpage which kicks back xml. My page needs to read the values of the probes. I don't know much about javascript and have been unsuccessful trying to use httprequest. I guess this would be considered cross domain as well? Here is the XML that is generated from the unit. I get this by pulling through a web browser x.x.x.x/xmldata Thanks <?xml version="1.0" encoding="ISO-8859-1"?> <Sensatronics id="S10604" hb="10554"> <Group id="1"> <Probe id="100"><Value>75.2</Value></Probe> </Group> <Group id="2"> </Group> <Group id="3"> </Group> <Group id="4"> </Group> <Group id="5"> </Group> <Group id="6"> </Group> <Group id="7"> </Group> <Group id="8"> </Group> <Group id="9"> <Probe id="99"><Value>1.0</Value></Probe> <Probe id="1"><Value>79.5</Value></Probe> <Probe id="2"><Value>34.3</Value></Probe> <Probe id="3"><Value>35.6</Value></Probe> <Probe id="4"><Value>0.0</Value></Probe> </Group> </Sensatronics> Code: rownumber = 2; detailsTable = document.getElementsByName("detailsTable"); detailsRow = detailsTable.getElementsByTagName("tr")[rownumber]; name = detailsRow.getElementsbyTagName("td")[0]; address = detailsRow.getElementsbyTagName("td")[1]; address2 = detailsRow.getElementsbyTagName("td")[2]; phone = detailsRow.getElementsbyTagName("td")[3]; email = detailsRow.getElementsbyTagName("td")[4]; alert(name); I have been told if I want to get the text from each cell I can use: alert(name.firstChild.nodeValue); But I don't understand how to do this for what I am wanting to do. Here is my HTML: Code: <table border="0" name="detailsTable"> <tr> <td>a</td> <td>b</td> <td>c</td> <td>d</td> <td>e</td> </tr> </table> I am still learning HTML, JavaScript and web design, so be patient with and reply in details. I want to be able to send data store in JavaScript variable to my email account. I have tried using mailto: command and for some reason it doesn't work. C Can someone please show me how to in details. I have a some code that I have been working on but I do not have the greatest understanding of cookies. If someone could help me out with this it would be greatly appreciated. Basically I have a cookie called webvpn and I need the data from the content part of the cookie. Then I need to use that at the beginning of my url. The content looks something like this, 791152394@265814016@1305568856@B762F295B8829D242481C9DD285D0339A719D96C So I need to get the data from content and then use that in the code where it says VARFROMCOOOKIEHERE then basically the rest of the link goes after it. Here is what I have so far: Code: <html> <body> <script language="javascript" type="text/javascript"> if (navigator.appVersion.indexOf("Mac")!=-1){ var str = "Smart-Tunnel Test MACS"; document.write(str.link("https://thenet.cckl.org/+CSCOE+/tunnel_mac.jnlp?app=/Applications/Firefox.app/Contents/MacOS/firefox-bin&url=http%3A%2F%2Fgroups%2Fpsnet%2FDirect.htm")); } else { var str = "Smart-Tunnel Test IE"; document.write(str.link("https://thenet.cckl.org/+CSCOE+/appstatus/VARFROMCOOKIEHERE?method=get&query=startstpage&url=http%3A%2F%2Fgroups%2Fpsnet%2FDirect.htm")); } </script> </body> </html> Html Code Code: <div id="itemStockUnit"> Qty <input type="text" size="2" value="1" class="quantity"> <select id="stockUnit" style="width:100%"> <option rel="Window1;7-10;153.00;140.24;">615W x 705H (mm)</option> <option rel="Windows2;7-10;187.00;171.09;">625W x 745H (mm)</option> <b>Delivery:</b> <span id="itemDeliveryTime">7-10</span> days <br> <small><b>RRP:</b> £<span id="itemRRPPrice">153.00</span></small> <br> <b>Our Price: <span id="itemOurPrice">£140.24</span></b> </div> JavaScript Code: <script type="text/javascript"> google.setOnLoadCallback(function() { $("#stockUnit").change(function(){ var data = ($("option:selected",this).attr("rel")).split(";"); $("#itemDeliveryTime").fadeOut().html(data[1]).fadeIn(); $("#itemRRPPrice").fadeOut().html(data[2]).fadeIn(); $("#itemOurPrice").fadeOut().html(data[3]).fadeIn(); }); }); </script> I have set data types to each option however the javascript above doesnt make it change any help? Hi guys, I'm trying to run this sample file that i got from the google docs. I want to write a stock ticker from google finances xml feed and this is a sample they had. Code: <?xml version="1.0" encoding="utf-8"?> <Module> <ModulePrefs title="hellofinance"> <Require feature="finance"/> </ModulePrefs> <Content type="html"> <![CDATA[ Hello world! Here is your portfolio:<br/> GOOG: <span id=_IG_SYM1_l></span> (<span id=_IG_SYM1_c></span>)<br/> AAPL: <span id=_IG_SYM2_l></span> (<span id=_IG_SYM2_c></span>)<br/> INTC: <span id=_IG_SYM3_l></span> (<span id=_IG_SYM3_c></span>)<br/> <script> var quote = new google.finance.Quote(); quote.enableDomUpdates( { 'GOOG' : '_IG_SYM1', 'AAPL' : '_IG_SYM2', 'INTC' : '_IG_SYM3' } ); quote.getQuotes(["GOOG", "AAPL", "INTC"]); </script> ]]> </Content> </Module> my problem is i don't know how to execute it so i can see how it works. I tried sticking this code within a php file and it returns an error on the first line for unexpected t-string. So i tried changing the extension to xml and it just displays the code but does not execute. I'm stumped. Any help is appreciated. Thanks P.S. - Yes i do have the zend gdata framework installed and running on my server and is working correctly according to their test. Anyone that can help on this one it would be greatly appreciated... I need to make a form parses a result from column 1 of txt/csv file that has 7 columns. Column 1 is pay, column 2-7 are how many and the associated rows are the answers. In short 1 2 3 4 5 6 700 50 55 62 75 80 99 so if the customer enters i make 700 and i need 2 the result would be 55 as the output. Any idea on how to make that work with javascript? if (pay <=700 && widgets = 2) { document.write(55) elseif (pay <=700 && widgets = 1) document.write(50) is this doable and is it the easiest way to accomplish this? Hi, I am trying to pass data from one page to the next using a search. I have a search engine and im trying to get it to pass the data of the search to the search results page. im using this code
Code: <script type="text/javascript"> window.onload = function (){ try{document.getElementById('q').focus();}catch(e){} } function search() { var search_text = document.getElementById('q').value; window.location = '/search/'+encodeURI(search_text)+'/'; return false; } </script> and I am using this for the search Code: <form action="/search/" method="post" onSubmit="return search();"> <input type="text" id="q" name="q" value="" class="searc" style="width:350px; height:30px; font-size:18px; color:#C19051" /> <input type="submit" style="height:30px;" value="Search" class="submit"/> </form> Can anybody help me with this? Thanks This is what i am trying to do. I want to have data called up when a certain number is entered. If the correct item # is entered, the information is pulled up. Is this a good application for javascript? or for something like flash and actionscript? I'm brand new to both, but i'm very willing to learn. Thanks for your help! I have a data like the format below. How would I only extract the following data: meet, run into, encounter, run across, come across, see (The data after "Sense 1" and stops before the next "Sense #"? Quote: Synonyms (Grouped by Similarity of Meaning) of verb meet Sense 1: meet, run into, encounter, run across, come across, see Sense 7: meet, gather, assemble, forgather, foregather interact Sense 3: converge, meet Quote: function Main(strText) { var strResult; strResult = strText; return strResult; } i have know that JavaScript the data types are either:Primitive (number", "string", "boolean", "undefined",null), or Non-primitive (objects). but why the return values of using typeof can be "function"? i feel this collide with the above. Hi there I am a novice with JavaScript, and I was wondering how I would reorder a list of data. I googled this and found some ways but none of them really applied to me. I have a database with names of courses (its for a restaurant), they all have an ID which ranges from 1-8 (I only have 8 courses so far). I can add and delete courses from this table but I would like to be able to reorder theses courses, in other words change their ID, without having to go into the database and manually change itself. Thank you I want to pass the value to my object id = "Parameters" How can I do that? I had tried the code as posted below but it couldn't work. I'm using document.all.Parameters.data = tempParams[0]; to pass in the data to <OBJECT id="Parameters" style="Z-INDEX: 200; LEFT: 0px; TOP: 0px; POSITION: ABSOLUTE;" type=application/pdf height=800 width=1060 VIEWASTEXT scroll=yes></OBJECT> I also have tried document.getElementById("Parameters").data = tempParams[0]; but still doesn't work. The code attached as below. PHP Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Management System Manual</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" 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 right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert("Sorry, you do not have permission to right click."); return false; } return true; } document.onmousedown=right; document.onmouseup=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (document.layers) window.captureEvents(Event.MOUSEUP); window.onmousedown=right; window.onmouseup=right; // End --> </script> <script type="text/javascript" language="JavaScript1.2"> <!-- // Begin //Disable right click script //no alert var message=""; /////////////////////////////////// function onKeyDown() { if ( (event.altKey) || ((event.keyCode == 8) && (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password")) || ((event.ctrlKey) && ((event.keyCode == 82)) ) || (event.keyCode == 68) || (event.keyCode == 80) || (event.keyCode == 78) || (event.keyCode == 66) || (event.keyCode == 72) || (event.keyCode == 73) || (event.keyCode == 74) || (event.keyCode == 70) || (event.keyCode == 122) ) { event.keyCode = 0; event.returnValue = false; } } function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // End --> </script> <script type="text/javascript" language="JavaScript1.2"> function getParams() { var idx = document.URL.indexOf('?'); var idx1 = document.URL.indexOf('#'); var tempParams = new Object(); if (idx != -1) { var pairs = document.URL.substring(idx+1, idx1).split('?'); //pairs = 1; for (var i=0; i<pairs.length; i++) { nameVal = pairs[i].split('='); tempParams[0] = nameVal[1]; } } //document.getElementById("Parameters").data = tempParams[0]; //document.all.Parameters.data = tempParams[0]; document.all.Parameters.data = tempParams[0]; //alert (window.document.parameters.data); return false; } </script > </head> <style media="print"> body { display : none; } </style> </HEAD> </head> <!-- <body ondragstart="return false" onselectstart="return false" onkeydown=onKeyDown() onload=setInterval("window.clipboardData.clearData();getParams();",2) oncontextmenu="return false" scroll=yes > --> <body ondragstart="return false" onselectstart="return false" onkeydown=onKeyDown() onload=getParams() oncontextmenu="return false" scroll=yes > <!--<input id="abc" type="text"/>--> <form id="frmRestricted" method="post"> <div id="Layer2" style="position:absolute; left:0px; top:-35px; width:1060; height:800; z-index:201"> <OBJECT id="Parameters" style="Z-INDEX: 200; LEFT: 0px; TOP: 0px; POSITION: ABSOLUTE;" type=application/pdf height=800 width=1060 VIEWASTEXT scroll=yes></OBJECT> </div> </form> </body> </html> Thank you very much |