JavaScript - Noscript Not Displaying In Ie
Hi,
I've got this bit if JavaScript that loads a Flash applet. It also has a noscript tag in case the user has JavaScript turned off. Works great in all browsers I've tried, but it doesn't work at all in IE8 (nor IE7 emulated). Even the noscript content isn't showing up. W3C validator shows no issues. No little exclamation point warning in IE's bottom-left corner. I've even tried lowering the browser security with no change -- but that wouldn't have been a good solution if it had worked anyway; I can't tell my visitors to lower their browser security. Any ideas of suggestions? Thanks for any help! You can see the page he http://www.girlscoutsmoheartland.org/test/vcattest.html If you look at the source, that's all there is to it. No undisplayed server-side scripting. And here's the code if you don't want to visit the page: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <script type="text/javascript" src="http://www.myvirtualpaper.com/js/miniflipper.js"></script> </head> <body> Below this line should be either a Flash applet, or a link if JavaScript is unavailable:<br> <noscript><a href="http://www.myvirtualpaper.com/doc/gs_missouri_heartland/girlscout2010catalog/">Click here to view all pages.</a></noscript> <script type="text/javascript"> var miniFlipperOptions = {'uid' : 'bfbe7aa59d'}; MVP_printMiniflipper(miniFlipperOptions); </script> <br> Above this line should be the mentioned item option. </body> </html> Similar TutorialsSo I was going to comment on another thread that was up a few days ago, but it is resolved and figured best to not repost on it anyways (can you repost on a resolved thread?) anyways... it was this thread and as rnd_me said the <noscript> tag is only supposed to be used in the body. So the reason I began thinking of this is because I am coding asp.net and using a master page. I cannot have <head> tags in the child pages because they get their <head> tags from the master... so i ran into the issue of redirecting clients if they do/do not have js enabled. the problem is if i use a script in the <head> on the master page and then the children get it, everytime a user clicks a link to goto a page they will be redirected to the default js page (script that redirects will be placed on every page). So I am playing around with how to do this the easiest and thought of that thread and thought, well if my default page is the "js enabled page" then i can put the noscript tag in the body and it will redirect users to the non js page and then i no longer have to worry about using the script in the <head> tags... am I making sense? upon further thought though you can put <script> tags anywhere, it is just generally placed in the <head> <-- this is an accurate statement correct?.... so i guess my question/reason for this post is to get feedback... i think it might be a "6, half-dozen the other" situation and just pend on "my style" but do you guys feel (keep in mind that this has to be done outside the <head> tag and inside the <body> tag) it is better to have default page be for script disabled and have a <script> which redirects, or the default page be js enabled and use the <noscript> tag? I guess it would come down to which one processes quicker? any thoughts on this would be great- I feel i have an answer (well two) but wanted feedback on which is better (and preferably a reason as to why one is better eg speed or something)... also if anyone reading could correct me if I am thinking incorrectly about this whole matter that would be great too Ok, I have an ajax form that uses "onkeyup" in an input to display dynamic data. I want to change the value of the input to "Enable javascript" if the user has javascript disabled. Any suggestions on how to accomplish this? Thanks, somniculouse Hello everybody, What I have been trying to incorporate into my site is that if a user has javascript turned off, it redirects them to another page. This is what I have found but doesn't seem to work. Code: <NOSCRIPT> <meta http-equiv=”refresh” content=”0; URL=AlternatePage.cfm”> </NOSCRIPT> When I test it out it shows on the page like this: meta http-equiv=”refresh” content=”0; URL=AlternatePage.cfm” Basically shows the same thing without the tags. It doesn't take any action at all. Any ideas, tips, or advice? I don't have any access to the root directory so SSI is not an option at the moment. (Do plan of hosting it on a dedicated server when I have the money ) I have a simple form and the noscript tag I have inserted is displaying as not valid as it is within the form section. Where could I place the noscript tags. Code: <form id="form" action="process.php" enctype="multipart/form-data" method="post" name="form_to_email" onsubmit="return Validate();"> <fieldset> <legend>Your details</legend> <p><label for="name"><span>* Name:</span></label><input id="name" name="name" size="45" type="text"/></p><p><label for="email"><span>* Email:</span></label><input id="email" name="email" size="45" type="text" /></p><p><label for="subject"><span>* Subject:</span></label><input id="subject" name="subject" size="45" type="text" /></p></fieldset><fieldset class="message"> <legend>Message</legend><textarea id="message" name="message" cols="55" rows="5"></textarea> </fieldset> <fieldset class="bold"> *All fields Required</fieldset> <script type="text/javascript"> var RecaptchaOptions = { theme : 'clean', tabindex : 0 }; </script> <noscript><p>Please enable javascript in your browser to post this form</p></noscript> <?php require_once('recaptchalib.php'); $publickey = ""; echo recaptcha_get_html($publickey, $error); ?> <p><input id="submit" name="submit" type="submit" value="Submit" /></p></form> I am using xhtml strict. If I place it after the form tag, will it still work if javascript is disabled? I have a 'show more' link on my page and wish to allow users who disable javascript to automatically see this normally hidden div as the link obviously will not work. is this possible ? the info in the hidden div will be taken from MySQL databases. Code: <div><!-- start of div2 --> <div class="floatleft"><a href="#" id="textbox-show" class="showLink" onclick="showHide('textbox');return false;">Show more</a> </div> <div><!-- start of div3 --> <div id="textbox" class="more"> <div class="formtitles">Show more <a href="#" id="textbox-hide" class="hideLink" onclick="showHide('textbox');return false;">Hide this content</a> </div> <div> <div class="containercolour3"> <div class="rtopcolour3"> <div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div> </div> <div class="formspacer">Hidden text</div> <div class="rbottomcolour3"> <div class="r4"></div><div class="r3"></div><div class="r2"></div><div class="r1"></div> </div> </div> </div> </div> <!-- end of div3 --></div> <!-- end of div2 --></div> Ahoy, Lemme try to explain this as best as I can. Bullet points might help: When someone clicks on an image here (http://gta.kwivia.co.uk/gta-iv/), the rest of the images collapse and become invisible Below the image, some links appear Also, there will be a "show other images" button which will then show the rest of the images http://gta.kwivia.co.uk/gta-iv/ I will appreciate all solutions to this problem. If you need to know anything, simply ask me. Hello, for some reason this code isnt showing anything: Code: <span id = "message" style="color:black; font-size:12pt; font-family:arial,verdana,sans-serif"></span> <script type = "text/javascript"> var targetURL="#"; var countdownfrom = 10; var currentsecond = countdownfrom +1; function countredirect() { if (currentsecond !=1 ){ currentsecond -=1; var mess = "You will be redirected to Points2shop in " + currentsecond + " seconds."; document.getElementById("message").innerHTML = mess; } else{ window.location=targetURL; } setTimeout("countredirect()",1000); } countredirect(); </script> ive tried: Code: <form name="message"> <span id = "message" style="color:black; font-size:12pt; font-family:arial,verdana,sans-serif"></span> </form> <script type = "text/javascript"> var targetURL="#"; var countdownfrom = 10; var currentsecond = countdownfrom +1; function countredirect() { if (currentsecond !=1 ){ currentsecond -=1; var mess = "You will be redirected to Points2shop in " + currentsecond + " seconds."; document.getElementById("message").innerHTML = mess; } else{ window.location=targetURL; } setTimeout("countredirect()",1000); } countredirect(); </script> Anyone know why? Thanks I wrote a function (shown below) that is to take numbers from <div> tags add them up and display the value in a different <div> tag. It also prints the total in a hidden input tag to be sent when submitted. All was working fine until today I noticed that the total was no longer showing up in either the <div> tag or the hidden input tag. on change of any of the select menus correctly displays the expected value in its corresponding <div> tag I have no Idea what might be causing this, so I need fresh eyes. (My JavaScript skills are way below my php skills, I can't see anything wrong with what I have) PHP Code: // I am using a php function that spits out these // (one for each item listed in the JS function: <select name="body" onchange="document.getElementById('total_body').innerHTML = this.options[this.selectedIndex].getAttribute('cost_body');calcTotal();" id="frm"> <option value="2" cost_body="0">2</option> <option value="3" cost_body="10">3</option> <option value="4" cost_body="20">4</option> <option value="5" cost_body="30">5</option> <option value="6" cost_body="40">6</option> <option value="7" cost_body="65">7</option> </select> //Which displays in: <div id="total_body">0</div> //AND Calls this JavaScript Function: <script type="text/javascript"> function calcTotal(){ var numVal1=parseInt(document.getElementById("total_body").innerHTML); var numVal2=parseInt(document.getElementById("total_agility").innerHTML); var numVal3=parseInt(document.getElementById("total_reaction").innerHTML); var numVal4=parseInt(document.getElementById("total_strength").innerHTML); var numVal5=parseInt(document.getElementById("total_charisma").innerHTML); var numVal6=parseInt(document.getElementById("total_intuition").innerHTML); var numVal7=parseInt(document.getElementById("total_logic").innerHTML); var numVal8=parseInt(document.getElementById("total_willpower").innerHTML); var numVal9=parseInt(document.getElementById("total_edge").innerHTML); var numVal10=parseInt(document.getElementById("total_magic").innerHTML); var totalValue = numVal1 + numVal2 + numVal3 + numVal4 + numVal5 + numVal6 + numVal7 + numVal8 + numVal9 + numVal10; document.getElementById("grand_total").innerHTML = totalValue; document.getElementById("point_total").value = totalValue; } </script> //Which until today had been displaying in: <div align="center" id="grand_total">0</div> //AND <input type="hidden" name="point_total" value="" id="point_total"> Here is a page that shows what it is (not) doing. http://rpg.5150press.com/test.php Hi, I am trying to display some xml elements that are formatted like this: Code: <line> <route> <dirs>1. Head west on Calzada Roosevelt</dirs> <time>4.6 km - about 15 mins</time> <dirs>2. Continue on Carretera Interamericana/Pan American Hwy</dirs> <time>15 km - about 12 mins</time> <dirs>3. Look for turnoff at San Lucas and follow signs from there</dirs> <time>13.5 km - about 15 mins</time> </route> </line> using this js: Code: for (var a = 0; a < lines.length; a++) { routeInfo = lines[a].getElementsByTagName("route"); for (var p = 0; p < routeInfo.length; p++) { var time = GXml.value(routeInfo[p].getElementsByTagName("time")[0]); var dirs = GXml.value(routeInfo[p].getElementsByTagName("dirs")[0]); way+='<b>'+dirs+'</b>'+'<br>'+time+'<br>'; ("way" eventually gets passed as the text to display) Which works OK (as you can see here if you select from Guatemala City to Antigua), but the problem is that it only shows the first set of directions, ie Code: <dirs>1. Head west on Calzada Roosevelt</dirs> <time>4.6 km - about 15 mins</time> I can see that this is because of the [0] in the getElementsByTagName - if I change it to 1 or 2 it shows the 2nd or 3rd set of directions. But I want it to show all of them... and I thought that being in a loop it would, but I'm obviously missing something. Any ideas? Thanks in advance. I can't seem to get my innerHTML to display my content. This works fine, if I was to put it all in one line. Code: document.getElementById('addedText').innerHTML = '<table><tr><td>'+"My text goes here"+'</tr></td></table>'; If I was to break it up, which I wanted then nothing seem to show up. Code: document.getElementById('addedText').innerHTML = '<table><tr><td>'; document.getElementById('addedText').innerHTML = "My text goes here"; document.getElementById('addedText').innerHTML = '</tr></td></table>'; Here's my code Code: <html> <head> <script type="text/javascript"> function display() { document.getElementById('addedText').innerHTML = '<table border=1><tr><td>'; document.getElementById('addedText').innerHTML = "My text goes here"; document.getElementById('addedText').innerHTML = '</tr></td></table>'; } </script> </head> <body onload="display()"> <div id="addedText"></div> </body> </html> thanks Hello all, I need your help. I know what I'm trying to do, just having a difficult time getting started. I want to display the user-name of an individual when they login. I know how this can be doing using php, but what about javascript? Ex: username: __________ password: __________ After Login: Welcome ['username'] I hope that makes sense. Thanks in advance I'm not sure if java is the best way to go with this, I'm pretty inexperienced with java, but I have a workable knowledge of html, and couldn't see a way to do it that way... so here goes: For my job I work with a ton of different deadlines all the time. What I want to do is to make a webpage that displays the date N days ago, and N days into the future. So something like 7 days ago, 30 days ago, 60 days ago 75 days ago, 30 days from now, 60 days from now, 75 days from now. etc. I've found brief snippets for how to display today's date, but i'm having trouble with the calculations. Then I also need one that displays 18 years ago, I'm not sure if the change from days to years makes any kind of difference, but I suppose it's easy enough to convert years to days anyway.... How would I go about doing that? Thank you!!! I thought I knew how, but I'm unclear how to get this function to display: "document.getElementById("txtHint").innerHTML=xmlhttp.responseText;" inside the div. Will you show me please? Code: xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var div = document.createElement('div'); div.setAttribute('id', 'txtHint'); div.setAttribute("style","background-color:red;"); div.style.width = '300px'; div.style.height = '100px'; document.getElementById("txtHint").innerHTML=xmlhttp.responseText; //var txt='hello world!'; document.getElementsByTagName('body')[0].appendChild(div); document.getElementById('textHint').innerHTML=txt; } } I am creating a script to display some variable but it won't work. Did I do something wrong? Code: <script type="text/javascript"> /* <![CDATA[ */ var yotta = le24; var zetta = le21; document.write("<table border='1' width='100%'><tr><th>Prefix</th><th>Decimal Equivalent</th></tr>"); document.write("<tr><td>Yotta</td><td>" + yotta + "</td></tr>"); document.write("<tr><td>Zetta</td><td>" + zetta + "</td></tr>"); document.write("</table>"); /* ]]> */ </script> Everything looks right, I think. Anyone see something wrong? Thank you, I am a firefighter of 25 years. Hello all, I'm trying to create a sub menu that displays based on what the user clicks on the main nav. Here's an image of what I'm trying to accomplish. The main nav is at the top right corner, when the click on one of the links, I want the sub nav to display in the gray area....how would I do this. Would it be through an if/else statement using document.getElementById with inner HTML? Or would there be a better way. I'm really trying to do this by myself, so please don't do it for me...just give me a couple of suggestions if you don't mind. THanks I am having a problem with my homework displaying an iframe using JavaScript. My homework states: Insert a script element that does the following: part a. Insert the following multiline comment: Display the daily schedule in an inline frame. Daily schedules are stored in the files sunday.html through saturday.htm. part b. Insert a command to write the HTML code <iframe src="weekday.htm'></iframe> to the Web page, where weekday is the text string returned by the weekDay() function. What I have so far: <script type= "text/javascript"> /* Display part a */ document.write("<iframe src='weekday.htm'></iframe">; </script> My Question: How do I display weekday.htm within my script on a specific day using the function weekDay() function. below is my weekDay() function: function weekDay(){ thisDate = new Date(); var thisWDay=thisDate.getDay(); var wdName = new Array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"); return wdName[thisWDay]; } I have to display a div before firing a sync ajax in javascript div is getting displayed in firefox but not in IE and chrome. I need to basically display a download bar to indicate the user that the request is in progress Alright so I've been searching around trying to figure out how to change the date format, the way I have seen it the most is like Code: var d=new Date(); var datestring=d.getdate + d.getMonth + d.get Year I am new to javascript and this is the first script I have written on my own so this is what it does. It is supposed to display the date that a shipment should arrive on with 2 day shipping through ups so it skips weekends. It displays the date after either adding 2 days or more depending on the day of the week. But the way the date is formatted really needs to be changed. So if any one can suggest maybe how to tie in the above code with mine that would be great. Code: <script type="text/javascript"> var d=new Date(); var day=d.getDay(); if (day <= 3){ d.setDate (d.getDate() + 2); } else if (day == 4) { d.setDate (d.getDate() + 4) } else if (day == 5){ d.setDate (d.getDate() + 4); } else if (day == 6) { d.setDate (d.getDate() + 3); } document.write("Your card should arrive on " + d); </script> Problem/Error: JavaScript/AJAX not returning values correctly... The JavaScript/AJAX is printing "null" into the chat_div where the tag name is "user". But in those tags there is actually data, this data is a link. I am thinking that it may be returning the first childNode which would be the <a>? I don't fully understand nodes, but I have had a quick read about them. PHP: PHP Code: <?php //Headers header("Expires: Mon, 01 Dec 1990 05:00:00 GMT" ); header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header("Cache-Control: no-cache, must-revalidate" ); header("Pragma: no-cache" ); header("Content-Type: text/xml; charset=utf-8"); require("connect.php"); mysql_select_db($dbname, $con); //Variables $ses = explode(".", $_SESSION['user']); //User ID of user currently logged in $sid = $ses[2]; //Number of last message which was displayed, if does not exist or has no value then //last message will be 0. $last_mess = (isset($_GET['m']) && $_GET['m'] != "") ? $_GET['m'] : 0; $last_mess = mysql_real_escape_string($last_mess); $chat = mysql_real_escape_string($_GET['chat']); //Counter for counter number of errors $i = 1; //Send message if (isset($_POST['message']) && $_POST['message'] != "") { //Variables $chat = mysql_real_escape_string($_GET['chat']); $message = mysql_real_escape_string($_GET['message']); $query = "INSERT INTO message (chat_id, user_uid, recipient_uid, message, post_time) VALUES (". $chat.", ".$sid.", ".$rid.", ".$message.", NOW())"; mysql_query($query); } //Get current chat if (isset($_GET['chat'])) { $xml = '<?xml version="1.0" ?><root>'; $query = "SELECT * FROM message WHERE chat_id = ".$chat." AND msg_id > ".$last_mess; $result = mysql_query($query); while ($row=mysql_fetch_array($result)) { //Get name of sender $get_name_query = "SELECT * FROM users WHERE uid = '".$row['user_uid']."' OR uid = '".$row['recipient_uid']."'"; $get_name = mysql_query($get_name_query); if (!$get_name) { //If there is no result display error echo "Error $i: Error getting usernames! <br /> Query: $get_name_query <br />MySQL Error: ".mysql_error(). "<br /><br />"; $i++; } //While result is being got get first name and upper case first letter. while ($row2=mysql_fetch_array($get_name)) { $name = explode(".",$row2['full_name']); $first_name = $name[0]; $userid = $row2['uid']; $sent_by = "<a href=\"../profile.php?user=".$userid."\">".ucfirst($first_name)."</a>"; } //Write message contents $xml .= '<message id="' . $row['msg_id'] . '">'; $xml .= '<user>' . $sent_by . '</user>'; $xml .= '<text>' . $row['message'] . '</text>'; $xml .= '<time>' . $row['post_time'] . '</time>'; $xml .= '</message>'; } $xml .= '</root>'; echo $xml; } ?> JavaScript/AJAX: Code: function getMessage() { if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { var url = "scripts/get_data.php?uid=<?=$uid?>&m=" + lastMess + "&chat=1"; receiveReq.open("GET", url, true); receiveReq.onreadystatechange = manageMessage; receiveReq.send( null ); lastMess++; } } function manageMessage() { if( receiveReq.readyState == 4 ) { // request complete var chat_div = document.getElementById( 'chat' ); var xmldoc = receiveReq.responseXML; var msg_nodes = xmldoc.getElementsByTagName( 'message' ); var n_msg = msg_nodes.length; for( i = 0; i < n_msg; i++ ) { var user_node = msg_nodes[ i ].getElementsByTagName( 'user' ); var time_node = msg_nodes[ i ].getElementsByTagName( 'time' ); var text_node = msg_nodes[ i ].getElementsByTagName( 'text' ); //Display message chat_div.innerHTML += user_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += time_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += text_node[ 0 ].firstChild.nodeValue + "<br /><br />"; } } } More info: The PHP is displaying the data properly, like so: XML: Code: <root> <message id="1"> <user> <a href="../profile.php?user=4">Nicholas</a> </user> <text>testing stupid chat thing</text> <time>0000-00-00 00:00:00</time> </message> <message id="2"> <user> <a href="../profile.php?user=4">Nicholas</a> </user> <text>dsadasfsdfsggsdgrgsdgfd</text> <time>2010-04-22 19:17:16</time> </message> <message id="3"> <user> <a href="../profile.php?user=4">Nicholas</a> </user> <text>gfgdgsegegsgfawdfwdfasfa</text> <time>2010-04-14 17:28:07</time> </message> </root> What is being displayed on the page: Code: null 0000-00-00 00:00:00 testing stupid chat thing null 2010-04-22 19:17:16 dsadasfsdfsggsdgrgsdgfd null 2010-04-14 17:28:07 gfgdgsegegsgfawdfwdfasfa Hi, I'm having problems displaying images on a site. Basically I have a to change an image each time a button is pressed on a piece of hardware. This is the code to detect a button press Code: // Check Button tstileo = new Image(); tstilec = new Image(); tstileo.src = '/images/1.jpg'; tstilec.src = '/images/2.jpg'; document.getElementById('btn0').innerHTML = (getXMLValue(xmlData, 'btn0') == 'up') ? document.Image=(tstileo): document.Image=(tstilec); So when the button is pressed/unpressed it should display tstileo and tstilec What format should my HTML code be to display the image ? This is whats there at the moment Code: <span id="btn0">?</span></p> When running all I get is text saying Code: [OBJECT HTMLImageElement] This site is being hosted on a microchip, btn0 is a press button switch on the board. The idea is to use this as a remote monitoring system. It runs Javascript XML HTML and CSS. Any help would be greatly appreciated, I have spent hours searching for a way to do this ( simple ? ) task but haven't got any further than this. Thanks Jay |