JavaScript - Ie/ff Alignment Issue (js/css Problem)
I wasn't sure whether this needed to go in Javascript or in CSS.
In the code I have below, I have a popup box that's displayed via javascript. It is supposed to be displayed in the center of the screen no matter what the location of the link is when it is clicked. All the JS part works fine, I believe the issue is in the HTML/CSS itself, but I'm not sure. As it is now, it works fine on IE, and everything is aligned properly, but it is offset to the right (by roughly 150px or so, I think) in Firefox. However, if I uncomment the line that is commented out (which would define the "right" attribute" of #outside and #behindoutside, instead of leaving it to default), the problem is reversed. Does this have something to do with a difference in FF/IE's handling of the "position" attribute in CSS? That has been my best guess so far but I still haven't been able to fix the error. Also, the box does not appear to fade in/out at all in IE. This is less of a concern to me than the alignment, but still somewhat of a problem. EDIT: I've come up with a (hopefully temporary) solution of using an if statement to determine if the browser is Firefox, but I would prefer to fix the actual source issue instead of just fixing the problem is causes.so Code: <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <meta name="generator" content="Adobe GoLive"> <title>Untitled Page</title> <script type="text/javascript" src="http://207.200.19.180/images/10000/6000/170BE/user/jquery-1.3.2.js" /></script> <style type="text/css"> #behindoutside{ opacity:0.90 !important; text-align: center; position: absolute; width: 100% !important; z-index: 0; } #x{ filter:alpha(opacity=90) !important; opacity:0.90 !important; } #image{ filter:alpha(opacity=90) !important; background-color: silver; border: 1px solid black; width: 100%; height: 100%; } #insidebehindoutside{ height: 420px; width: 550px; } #outside{ width: 100%; text-align: center; position: absolute; z-index: 1; } #popup{ text-align: center; height: 420px; width: 550px; } </style> <script language="javascript"> $(document).ready(function(){ $('#start').click(function(){ $("#outside, #behindoutside").fadeIn('normal'); var boxheight = $("#insidebehindoutside").height(); var tall = jQuery(window).height(); var scroll = jQuery(window).scrollTop(); var heightShift=((tall/ 2 ) - (boxheight / 2 )) + scroll; $("#outside, #behindoutside").css("top", heightShift); //$("#outside, #behindoutside").css("right", "2px"); }); $('#x').click(function(){ $('#outside, #behindoutside').fadeOut('normal'); }); }); </script> </head> <body> <div id="behindoutside" style="display:none;"> <center> <div id="insidebehindoutside"> <img id="image" src="http://207.200.19.180/images/10000/3000/914BE/user/blank.png"/> </div> </center> </div> <div id="outside" style="display:none;"> <center> <div id="popup"> <img id="x" style="float:right; position: relative; right: 5px; top:5px; cursor:pointer;" onmousedown="getElementById('x').src='http://207.200.19.180/images/10000/6000/170BE/user/xdown.gif'" onmouseup="getElementById('x').src='http://207.200.19.180/images/10000/6000/170BE/user/xup.gif';" onmouseout="getElementById('x').src='http://207.200.19.180/images/10000/6000/170BE/user/xup.gif'" src="http://207.200.19.180/images/10000/6000/170BE/user/xup.gif" /> <br><br> <p>Popup Content</p></div> </center> </div> <div> <center> <font size="3">Supply Lists</font> <hr align="center" width="25%" /> </center> <p align="center"><a id="start" style="color: blue; text-decoration: underline; cursor:pointer;" onclick="appear();">Click for popup box!</a></p> </div> </body> </html> Similar TutorialsHello, I'm using the jk mega menu found at: http://www.javascriptkit.com/script/...megamenu.shtml My menu is about 600px wide. When I resize the browser window smaller, the menu seems to auto adjust to the new window size and aligns the menu bottom/ extending left of the anchor, as opposed to the default (bottom/extending right.) I'd like to force the menu always extending right because extending left is sending it off the page left. Collapse this window smaller and roll over the menu and you'll see the issue: http://www.javascriptkit.com/script/...megamenu.shtml Thanks for any help you can provide and I appreciate your time, The tool tip box is way out and off in Chrome browser when I scroll down the page. Please check, download and go through this html file link - http://www.alparin.com/webtest/ixbrl_output2.htm and see what's wrong in the stylesheet/javascript code. I am just so desperate of moving forward with this issue still hanging in the air. Many thanks in advance for help and assistance! I need some help making a button function do what I want it to do. I have a index page that shows all my projects in a table with tabs you can click on that shows certain parts of all projects (ie tab for finance, project title). For now, every single project is shown on the website when you bring up the index page. Also the top part of the page, where I have the issue, there is a drop down list of all the projects with a "GO" button next to it. I want a user to be able to scroll down that list and click the button and the page would only show that particular project, ie choosing the tabs to go back and forth dealing with the one project only. The tabs are each its own .php file with the exact coding in all of them. Here is what I have on my index page that I need help on in order to make this button work. Any help will be appreciated. My main issue is this coding Code: <input type="button" value="GO" name="proj_list" /> But here is the whole index page Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>2009 Events</title> <link rel="stylesheet" type="text/css" href="../css/dddropdownpanel.css" /> <link rel="stylesheet" type="text/css" href="../css/sortable.css" /> <link rel="stylesheet" type="text/css" href="../css/datepicker.css" /> <link rel="stylesheet" type="text/css" href="../css/main.css" /> <link rel="stylesheet" type="text/css" href="../css/chromestyle.css" /> <link rel="stylesheet" type="text/css" href="../css/ajaxtabs.css" /> <script type="text/javascript" src="../includes/datepicker.js"></script> <script language="javascript" src="../includes/tablesort.js"></script> <script language="javascript" src="../includes/tableActions.js"></script> <script language="javascript" src="../includes/chrome.js"></script> <script language="javascript" src="../includes/ajaxtabs.js"></script> </head> <body> <div id="container"> <div id="header"> <?php include("../header.php"); ?> </div> <div id="navbar2"> <?php include("../menu.php"); ?> </div> <div id="content"> <div id="breadcrumb"> <script language="javascript" src="../includes/breadcrumbs.js"></script> </div> <?php // If the user wants to add a project if (isset($addproject)): else: $dbcnx = @mysql_connect("xxxxx", "xxxxxx", "xxxxxxxx"); if (!$dbcnx) { echo( "<P>Unable to connect to the xxxxxxxxx" . "database server at this time.</P>" ); exit(); } mysql_select_db("techweb", $dbcnx); if (! @mysql_select_db("techweb") ) { echo( "<P>Unable to connect to the xxxxxxx" . "database at this time.</P>" ); exit(); } // If a project has been submitted, // add it to the database. if ("SUBMIT" == $proj_submit) { $sql = "INSERT INTO projects SET " . "proj_priority='$priority', " . "proj_title='$title', " . "proj_bdlead='$bdlead', " . "proj_englead='$englead', " . "proj_objective='$objective', " . "proj_capability='$capability', " . "proj_approach='$approach', " . "proj_venue='$venue', " . "proj_tradeshow='$tradeshow', " . "proj_funding='$funding', " . "proj_src-ds='$src-ds', " . "proj_src-cap='$src-cap', " . "proj_src-irad='$src-irad', " . "proj_status='$status', " ; if (mysql_query($sql)) { echo("<P>Your project has been added.</P>"); } else { echo("<P>Error adding submitted project: " . mysql_error() . "</P>"); } } echo("<h1 style='text-align:left'> 2009 Projects </h1>"); // Request the text of all the projects $result = mysql_query( "SELECT * FROM projects"); if (!$result) { echo("<P>Error performing query: " . mysql_error() . "</P>"); exit(); } ?> <form id="projects" method="post" action="project.php"> <select id="project_list" name="proj_list"> <optgroup label="projects"> <?php // Display the details of each event in a table while ( $option = mysql_fetch_array($result) ) { echo("<option label=" . $option["proj_title"] . "value=" . $option["ID"] . ">" . $option["proj_title"] . "</option>"); } ?> </optgroup> </select> <input type="button" value="GO" name="proj_list" /> <? endif; ?> <div id="tabcontainer"> <ul id='tabs' class='shadetabs'> <?php // Populate tabs with data related to the selected project echo ("<li><a href='project.php' rel='container' class='selected'>Project</a></li>"); echo ("<li><a href='capability.php' rel='container'>Demo Capability</a></li>"); echo ("<li><a href='approach.php' rel='container'>Approach</a></li>"); echo ("<li><a href='venue.php' rel='container'>Venue/Trade Shows</a></li>"); echo ("<li><a href='financials.php' rel='container'>Financials</a></li>"); ?> </ul> <!-- <ul id='tabs' class='shadetabs'> <li><a href='project.php' rel='container' class='selected'>Project</a></li> <li><a href='capability.php' rel='container'>Demo Capability</a></li> <li><a href='approach.php' rel='container'>Approach</a></li> <li><a href='venue.php' rel='container'>Venue/Trade Shows</a></li> <li><a href='financials.php' rel='container'>Financials</a></li> </ul> --> <div id="divcontainer" style="border:1px solid gray; width:600px; margin-bottom: 1em; padding: 5px"> <p>Please select a project using the drop-down menu above. Use the tabs to view information about the selected project.</p> </div> <script type="text/javascript"> var countries=new ddajaxtabs("tabs", "divcontainer") countries.setpersist(true) countries.setselectedClassTarget("link") //"link" or "linkparent" countries.init() </script> </div> Hey just a quick question... I have something centered on my page (its a table). How can I align something to the left of what I already have centered?
Hello everyone, I am new to CSS and am having some difficulties with javascript alignment. I have inserted the proper script into my banner and it is in the proper spot but its too far left. I would like to be able to move it into the center. What should I be adjusting? Not really sure how padding etc all works and not sure if that's how i would go about fixing it. Thanks I've having a problem with alignment on my portfolio. It works in mozilla although you may need to refresh the page, and it doesn't work in chrome at all. does anyone know why? the address is townsendwebdd.com thanks, I am totaly stuck I would like to change the alignment of an image which currently under div which is under iframe. the page which is called under iframe is readymade html from some other site. I dont have any control on that HTML page which is under iframe. Please tell me how to align image under iframe.
I have the following sample html file (attached). I am trying to display the calculated field using javascript and I created a function (I am a newbie) to do so. However, it persistently shows NaN instead of the required number. I have tried my best over a coupla hours racking my brains and the internet as to why it shows as not a number. I will appreciate any help. Thanks, Freaking IE. Must die. Really it must. Unfortunately, I have to code for it, and I can't figure out what went wrong he http://wyqued-design.com/dev/skyview/index.html The navigation, and layout, breaks in IE 7. Any ideas? -Emilie Hi Experimenting. Trying to add a simple onclick event via onload, but I can't get it right? This works: Code: function checkStatus(box){ if(box.checked != box.defaultChecked){ alert("box status has changed"); } } HTML <input type="checkbox" name="mycheckbox" id="mycheckbox" value="&cost=free" onclick="checkStatus(this)" /> This does not: Code: <input type="checkbox" name="mycheckbox" id="mycheckbox" value="&cost=free" /> window.onload = function (){ var mybox = document.getElementById('mycheckbox'); mybox.onclick = checkStatus ; //how to get this to work?? //none of the following work //mybox.onclick = checkStatus; //this calls the function but I don't have a box ref //mybox.onclick = checkStatus(); //mybox.onclick = checkStatus(this); //mybox.onclick = checkStatus(mybox); } LT I have a problem that I have been told to fix. The code that is there work perfectly in Firefox, but throws errors in IE and will not work. Code: var newtbody = document.createElement("tbody"); newtbody.id = "ROW"+newkey; document.getElementById(trElement).parentNode.insertBefore(newtbody,document.getElementById(trElement)); newtbody.innerHTML = gcp; gcp has the HTML for inside the tbody tag. The error I get in IE is the "Unknown runtime error". I have tried some of the "solutions" that I have seen online but none have worked. Can anyone help? I can't seem to play MP3s with jPlayer, only OGG. Any ideas? My custom code is below: Code: <script type="text/javascript"> //<![CDATA[ var audioPlaylist; var Playlist; jQuery(document).ready(function(){ Playlist = function(instance, playlist, options) { var self = this; this.instance = instance; // String: To associate specific HTML with this playlist this.playlist = playlist; // Array of Objects: The playlist this.options = options; // Object: The jPlayer constructor options for this playlist this.current = 0; this.cssId = { jPlayer: "jquery_jplayer_", interface: "jp_interface_", playlist: "jp_playlist_" }; this.cssSelector = {}; jQuery.each(this.cssId, function(entity, id) { self.cssSelector[entity] = "#" + id + self.instance; }); if(!this.options.cssSelectorAncestor) { this.options.cssSelectorAncestor = this.cssSelector.interface; } jQuery(this.cssSelector.jPlayer).jPlayer(this.options); jQuery(this.cssSelector.interface + " .jp-previous").click(function() { self.playlistPrev(); jQuery(this).blur(); return false; }); jQuery(this.cssSelector.interface + " .jp-next").click(function() { self.playlistNext(); jQuery(this).blur(); return false; }); }; Playlist.prototype = { displayPlaylist: function() { var self = this; jQuery(this.cssSelector.playlist + " ul").empty(); for (i=0; i < this.playlist.length; i++) { var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>"; listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>"; // Create links to free media if(this.playlist[i].free) { var first = true; listItem += "<div class='jp-free-media'>("; jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. if(first) { first = false; } else { listItem += " | "; } listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>"; } }); listItem += ")</span>"; } listItem += "</li>"; // Associate playlist items with their media jQuery(this.cssSelector.playlist + " ul").append(listItem); jQuery(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() { var index = jQuery(this).data("index"); if(self.current !== index) { self.playlistChange(index); } else { jQuery(self.cssSelector.jPlayer).jPlayer("play"); } $(this).blur(); return false; }); // Disable free media links to force access via right click if(this.playlist[i].free) { jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. jQuery(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() { var index = $(this).data("index"); jQuery(self.cssSelector.playlist + "_item_" + index).click(); jQuery(this).blur(); return false; }); } }); } } }, playlistInit: function(autoplay) { if(autoplay) { this.playlistChange(this.current); } else { this.playlistConfig(this.current); } }, playlistConfig: function(index) { jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current"); jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current"); this.current = index; jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); }, playlistChange: function(index) { this.playlistConfig(index); jQuery(this.cssSelector.jPlayer).jPlayer("play"); }, playlistNext: function() { var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; this.playlistChange(index); }, playlistPrev: function() { var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; this.playlistChange(index); }, supplied: "mp3", addMedia: function(media){ this.playlist.push(media); this.playlistNext(); } }; }); var last_el=''; jQuery('.track .wrap .play').click(function(){ var cur_img = jQuery(this).css('backgroundImage'); if(cur_img.substring(cur_img.length-10)=='play.png")'){ if(last_el!=''){ last_el.css('background-image','url("img/play.png")'); } var el = jQuery(this); last_el = el; parent.frames[1].addSong(el.attr("title"),el.attr("mp3"),el.attr("ogg")); el.css('background-image','url("img/pause.png")'); }else{ parent.frames[1].pauseSong(); } }); jQuery('.jp-interface .jp-pause').click(function(){ last_el.css('background-image','url("img/play.png")'); }); jQuery('body a').click(function(){ var el = jQuery(this); var href = el.attr('href'); if(href.substring(0,1)=='/'){ parent.location.href = parent.location.href + href.substring(1,href.length); } }); //]]> </script> Quote: Hi, below code is only working in Firefox but not in Internet Explorer. Once I select YES from drop down list, then the next text box should be greyed out and the second should show value 10. This works in Firefox but not in Firefox . Code: <html> <head> <title>Untitled</title> <script> function enable() { document.myForm.textbox.disabled = false; document.myForm.textbox2.value = 0; } function disable() { document.myForm.textbox.disabled = true; document.myForm.textbox2.value = 10; } function value() { document.myForm.textbox2.value = 10; } </script> </head> <body> <form name="myForm"> <table> <tr> <label> Do you accept </label> <td> <select name="na"> <option value="yes" onclick="disable()"> YES </option> <option value="no" onclick="enable()"> NO </option> <option value="NA" onclick="disable()"> NA </option> </select> <input type="text" name="textbox" value="" disabled> <input type="text" name="textbox2" value="10" > </td> </tr> <tr> <td> </td> </tr> </form> </body> </html> So I'm working on an autofill program for a site. What it does is it takes info from a form thats on MY site then it places that info into a form on another site. So my problem is that it won't to any of that. I know the autofill by itself works because I've tested it. I think that maybe my form doesn't know where in the autofill to place the info... My form: Code: <form name="logindetails" method="post"> <input type="text" name="email" value="Email Address" /> <input type="password" name="combination" value="Combination" /> <input type="submit" value="Submit" onclick="logindetails()"> Autofill script: Code: <script type="text/javascript"> function logindetails() { var values = ["email", "password", "password"]; $("input").each(function(i){ $(this).val(values[i]); }); document.getElementById("recaptcha_response_field" ).focus(); } </script> I am attempting to remove all HTML tags with nothing in the middle. For example, I want to remove this Code: <b><i><u> </u></i></b> I've written an expression that does that, but there's an issue with it. Here's my regex: Code: messageVal = messageVal.replace(/(<[^\/>]*>)+[\s]*(<\/[^>]*>)+/g,''); The issue is that I only want to delete as many end tags as I found open tags. An example that my regex doesn't work on is... Code: <b> hello <u><i> </i></u></b> The current regex will output: Code: <b> hello I need it to return: Code: <b> hello </b> Any ideas? I can't seem to play MP3s with jPlayer, only OGG. Any ideas? My custom code is below: Code: <script type="text/javascript"> //<![CDATA[ var audioPlaylist; var Playlist; jQuery(document).ready(function(){ Playlist = function(instance, playlist, options) { var self = this; this.instance = instance; // String: To associate specific HTML with this playlist this.playlist = playlist; // Array of Objects: The playlist this.options = options; // Object: The jPlayer constructor options for this playlist this.current = 0; this.cssId = { jPlayer: "jquery_jplayer_", interface: "jp_interface_", playlist: "jp_playlist_" }; this.cssSelector = {}; jQuery.each(this.cssId, function(entity, id) { self.cssSelector[entity] = "#" + id + self.instance; }); if(!this.options.cssSelectorAncestor) { this.options.cssSelectorAncestor = this.cssSelector.interface; } jQuery(this.cssSelector.jPlayer).jPlayer(this.options); jQuery(this.cssSelector.interface + " .jp-previous").click(function() { self.playlistPrev(); jQuery(this).blur(); return false; }); jQuery(this.cssSelector.interface + " .jp-next").click(function() { self.playlistNext(); jQuery(this).blur(); return false; }); }; Playlist.prototype = { displayPlaylist: function() { var self = this; jQuery(this.cssSelector.playlist + " ul").empty(); for (i=0; i < this.playlist.length; i++) { var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>"; listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>"; // Create links to free media if(this.playlist[i].free) { var first = true; listItem += "<div class='jp-free-media'>("; jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. if(first) { first = false; } else { listItem += " | "; } listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>"; } }); listItem += ")</span>"; } listItem += "</li>"; // Associate playlist items with their media jQuery(this.cssSelector.playlist + " ul").append(listItem); jQuery(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() { var index = jQuery(this).data("index"); if(self.current !== index) { self.playlistChange(index); } else { jQuery(self.cssSelector.jPlayer).jPlayer("play"); } $(this).blur(); return false; }); // Disable free media links to force access via right click if(this.playlist[i].free) { jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. jQuery(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() { var index = $(this).data("index"); jQuery(self.cssSelector.playlist + "_item_" + index).click(); jQuery(this).blur(); return false; }); } }); } } }, playlistInit: function(autoplay) { if(autoplay) { this.playlistChange(this.current); } else { this.playlistConfig(this.current); } }, playlistConfig: function(index) { jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current"); jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current"); this.current = index; jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); }, playlistChange: function(index) { this.playlistConfig(index); jQuery(this.cssSelector.jPlayer).jPlayer("play"); }, playlistNext: function() { var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; this.playlistChange(index); }, playlistPrev: function() { var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; this.playlistChange(index); }, supplied: "mp3", addMedia: function(media){ this.playlist.push(media); this.playlistNext(); } }; }); var last_el=''; jQuery('.track .wrap .play').click(function(){ var cur_img = jQuery(this).css('backgroundImage'); if(cur_img.substring(cur_img.length-10)=='play.png")'){ if(last_el!=''){ last_el.css('background-image','url("img/play.png")'); } var el = jQuery(this); last_el = el; parent.frames[1].addSong(el.attr("title"),el.attr("mp3"),el.attr("ogg")); el.css('background-image','url("img/pause.png")'); }else{ parent.frames[1].pauseSong(); } }); jQuery('.jp-interface .jp-pause').click(function(){ last_el.css('background-image','url("img/play.png")'); }); jQuery('body a').click(function(){ var el = jQuery(this); var href = el.attr('href'); if(href.substring(0,1)=='/'){ parent.location.href = parent.location.href + href.substring(1,href.length); } }); //]]> </script> I have the Jplayer.swf in multiple folders too to prevent path errors, but that still seems to not help. Anybody? This issue is right at the cross point between the java and javascript. Basically, I want to DYNAMICALLY pass some Cyrillic characters (such as Алла Пугачева) at the runtime to the javascript function, as following: Current text encoding setting is Cp1252 in JAVA IDE. response.getOutputStream().println("<script>test('" + testCoding +"');</script>"); If the testCoding is normal latin chracter (such as "abc, xyz"), this will work, so that at the runtime, it will execute the funciton test(param) and passing the parameter, "abc, xyz" to the javascript function test(param). The frontend javascript function test(param) will further display it as: field.innerHTML = param; But if it is the Cyrillic characters (such as Алла Пугачева), it won't work. The "Алла Пугачева" will be passed as the garbage character and displayed as so. How can I in the java class DYNAMICALLY set up the encoding so that the sysytem at the runtime will acccept the Cyrillic characters. I would believe I need to setup such ancoding as UTF-8. But I do not know how to? OR, How can I process the Cyrillic characters (such as Алла Пугачева), in the javascript function so that it can be displayed properly? Thanks Scott Code: <html> <script> function doit(){ document.write(document.getElementById('myIMG').getAttribute('src')); } </script> <body onLoad="doit()"> <img src="blabla.jpg" id="myIMG"> My question is, why is it, that after loading the page, the image that should be displayed at the page is not being displayed. The only thing that can be seen is text generated by the document.write function. Hello guys I am doing a simple calculation. Here is the code Code: dose=1 A = document.rhogam.bleed.value B = document.rhogam.volume.value dose= (A*B)/3 dose=Math.round(dose*10)/10; this works fine and gives me an answer rounded to the tenths spot. the next step i need to do is round up by one if the tenths spot is less than 4 or round up by 2 if the tenths is 5 plus example 3.3=4 3.6=5 The code issue I am having is how do I read the tenths place in my result so that I can act on it? Thanks Jeremy |