Search Results

Search found 2007 results on 81 pages for 'getelementbyid'.

Page 12/81 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Cannot change borderColor of TD

    - by Tadeus Prastowo
    Using JS to set the background color of a TD is fine. But, setting the border color is problematic in FF 3.0.18 although IE 6 doesn't experience this. FF is problematic in that it requires the TD element to have an attribute style initialized to border-style: solid. Without that, setting border color of a TD won't work. Is this known bug? How do I set the border color without having to set style attribute as well as the initialization value? I know another trick of setting the class attribute instead of setting the border color directly. Is this an indication that somehow TD hates having its border color set dynamically? Is this known as well? The problematic code is below (the goal is find out why setting the border color of simple truth 1 does not work while simple truth 3 works when I employ the trick described above): <html> <head> <title>Quirks FF 3.0.18</title> <style type="text/css"> table { border-collapse: collapse; } </style> <script type="text/javascript"> function changeBgColor() { document.getElementById('simple').style.backgroundColor='yellow'; document.getElementById('simple2').style.backgroundColor='yellow'; document.getElementById('simple3').style.backgroundColor='yellow'; } function quirk(id) { var x = document.getElementById(id); x.style.border = '2px solid red'; } </script> </head> <body> <input type="button" onclick="changeBgColor()" value="Change background color"/> <input type="button" onclick="quirk('simple')" value="Change border color 1"/> <input type="button" onclick="quirk('simple2')" value="Change border color 2"/> <input type="button" onclick="quirk('simple3')" value="Change border color 3"/> <table> <tr><td id="simple">Simple truth 1</td></tr> </table> <table> <tr><td><span id="simple2">Simple truth 2</span></td></tr> <table> <tr><td id="simple3" style="border-style: solid">Simple truth 3</td></tr> </table> </body> </html>

    Read the article

  • Crossbrowser JS...

    - by s4v10r
    Hi there all :) Made this nice little loop for hiding and showing div's, works as a charm in firefox and opera, but IE, safari and chrome say's no.... So my question is; why? function theme(nr){ document.getElementById(nr).style.display = "block"; for (i = 0;i <= 28; i++) { if (i != nr) { document.getElementById(i).style.display = "none"; } } } Thanx:)

    Read the article

  • How i can access javascript variable value in JSP

    - by Pramod
    function modification() { alert(document.getElementById("record").value); var rec=document.getElementById("record").value; <% Connection connect = DriverManager.getConnection("jdbc:odbc:DSN","scott","tiger"); Statement stm=connect.createStatement(); String record=""; // I want value of "rec" here. ResultSet rstmt=stm.executeQuery("select * from "+record); % }

    Read the article

  • How can I reliably set the class attr w/JavaScript on IE, FF, Chrome, etc.?

    - by Alloi
    Hi, I am using the below js code in order to change the class when a link is clicked. document.getElementById("gifts").setAttribute("class", "gkvSprite selected"); This is not working in IE but it does in FF and Chrome Then I changed the code to : document.getElementById("gifts").setAttribute("className", "gkvSprite selected"); Then it worked in IE stopped working in FF and Chrome. Could someone please help me out here? Thanks in Advance Alloi

    Read the article

  • How can I access a JavaScript variable value in JSP?

    - by Pramod
    function modification() { alert(document.getElementById("record").value); var rec=document.getElementById("record").value; <% Connection connect = DriverManager.getConnection("jdbc:odbc:DSN","scott","tiger"); Statement stm=connect.createStatement(); String record=""; // I want value of "rec" here. ResultSet rstmt=stm.executeQuery("select * from "+record); %> }

    Read the article

  • Focus on textbox based on URL.

    - by Cameron
    I have two forms on one page and want to have the input boxes focused based on the URL. So for example: domain.com/Default.aspx#login and domain.com/Default.aspx#register and the javascript I have this: window.document.getElementById('<%=txtUserName.ClientID %>').focus(); window.document.getElementById('<%=txtEmail.ClientID %>').focus(); it might be better if the urls are Default.aspx?action=login actually (not sure if this effects the way in which it would work)

    Read the article

  • difference between calling javascript function on body load or directly from script.

    - by Abbas
    i am using a javascript where in i am creating multiple div (say 5) at runtime, using javascript function, all the divs contain some text, which is again set at runtime, now i want to disable all the divs at runtime and have the page numbers in the bottom, so that whenever user clicks on the page number only that div should get visible else other should get disable, i have created a function, which accepts parameter, as page number, i enable the div whose page number is clicked and using a for loop, i disable all the other divs, now here my problem is i have created two functions, 1st (for adding divs and disabling all the divs except 1st) and writing content to it, and other for enabling the div whose page number is clicked, and i have called the Adding div function on body onload; now first time when i run, page everthing goes well, but next time when i click on any of the page number, it just gets enabled and again that AddDiv function, runs and re-enables all the divs.. Please reply why this is happening and how should i resolve my issue... Below is my script, content for the div are coming using Json. <body onload="JsonScript();"> <script language="javascript" type="text/javascript"> function JsonScript() { var existingDiv = document.getElementById("form1"); var newAnchorDiv = document.createElement("div"); newAnchorDiv.id = "anchorDiv"; var list = { "Article": articleList }; for(var i=0; i < list.Article.length; i++) { var newDiv = document.createElement("div"); newDiv.id = "div"+(i+1); newDiv.innerHTML = list.Article[i].toString(); newAnchorDiv.innerHTML += "<a href='' onclick='displayMessage("+(i+1)+")'>"+(i+1)+"</a>&nbsp;"; existingDiv.appendChild(newDiv); existingDiv.appendChild(newAnchorDiv); } for(var j = 2; j < list.Article.length + 1; j ++) { var getDivs = document.getElementById("div"+j); getDivs.style.display = "none"; } } function displayMessage(currentId) { var list = {"Article" : articleList} document.getElementById("div"+currentId).style.display = 'block'; for(var i = 1; i < list.Article.length + 1; i++) { if (i != currentId) { document.getElementById("div"+i).style.display = 'none'; } } } </script> Thanks and Regards

    Read the article

  • Dynamic positioning inside relative div

    - by ian
    I'm trying to get a color picker javascript widget working in a page with a bunch of "stuff" in it that I can't change. Some of the "stuff" is causing the color picker to appear well below the link when clicked. I've reduced it to a simple example below. <html> <head> <script type="text/javascript"> function setPos(aname,dname) { var o=document.getElementById(aname); var ol=o.offsetLeft; while ((o=o.offsetParent) != null) { ol += o.offsetLeft; } o=document.getElementById(aname); var ot=o.offsetTop + 25; while((o=o.offsetParent) != null) { ot += o.offsetTop; } document.getElementById(dname).style.left = ol + "px"; document.getElementById(dname).style.top = ot + "px"; } </script> <style> h1 {height: 50px;} #divMain {position: relative;} </style> </head> <body> <h1></h1> <div id="divMain"> <a href="#" onClick="setPos('link1','div1');return false;" name="link1" id="link1">link 1</a> <div id="div1" style="position:absolute;border-style:solid;left:200px;top:200px;">div 1</div> </div> </body> </html> What's supposed to happen is when you click "link 1", "div1" should move directly below "link 1". What actually happens is that "div 1" appears well below "link 1". If you remove position: relative; from the CSS definition for divMain, "div 1" is positioned correctly. How can I position "div 1" directly beneath "link 1" without removing position: relative;?

    Read the article

  • CSS Hidden DIV Form Submit

    - by Michael
    Using CSS, when a link is clicked it brings up a hidden DIV that contains a form. The user will then enter information and then submit the form. I'd like the hidden DIV to remain visisble, and a 'success message' to be displayed after submission. Then the user will have the option of closing the DIV. I can't get it to work without reloading the page, which causes the DIV to become hidden again. Any ideas? <body> <a href="javascript:showDiv()" style="color: #fff;">Click Me</a> <!--POPUP--> <div id="hideshow" style="visibility:hidden;"> <div id="fade"></div> <div class="popup_block"> <div class="popup"> <a href="javascript:hideDiv()"> <img src="images/icon_close.png" class="cntrl" title="Close" /> </a> <h3>Remove Camper</h3> <form method="post" onsubmit="email.php"> <p><input name="Name" type="text" /></p> <p><input name="Submit" type="submit" value="submit" /></p> </form> <div id="status" style="display:none;">success</div> </div> </div> </div> <!--END POPUP--> <script language=javascript type='text/javascript'> function hideDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'hidden'; } else { // IE 4 document.all.hideshow.style.visibility = 'hidden'; } } } function showDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'visible'; } else { // IE 4 document.all.hideshow.style.visibility = 'visible'; } } } </script> </body>

    Read the article

  • Javascript wont change value in TextBox

    - by mattgcon
    Here is my javascript function AppendValues(e) { var lghtcnt = 0; var vars = e.id.split(';'); var highcnt = false; var lghtid = ""; var maxltcnt = 100; for (var x = 0; x < vars.length; x++) { var tokens = vars[x].split('|'); var pram = tokens if (tokens[0] == "ID"){ lghtid = tokens[1]; } if (tokens[0] == "LTC"){ var itemcnt = 0; var currentcnt = 0; currentcnt = parseInt(tokens[1].toString()); var txtid = document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]); if (e.checked) { totallightcnt += currentcnt; if (totallightcnt > maxltcnt) { document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]).value = 0; alert('This puts you over the limit of 100 total lights, please make adjustments.'); break; } document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]).value = currentcnt.toString(); } else { totallightcnt -= currentcnt; document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]).value = 0; break; } } if (highcnt) { break; } } } Here is the issue, when I check the value it DOES say theupdated value but it does not display to the user on the webpage. What could be the issue?

    Read the article

  • Finding the methods/properties on a swf object

    - by Jones
    I have a swf object embedded into a web page. Without having access to the source code of the swf file, how can I find the methods/properties that are exposed? For example... alert(document.getElementById('swfObject').id); ...returns a pop-up of "swfObject". And this... document.getElementById('swfObject').someMethod(); ...executes someMethod. Thanks.

    Read the article

  • jquery sucess dropdown

    - by mckenzie
    hi, //codes success: function(html){ // this is for input box - working document.getElementById('val').value=''; $('#val').value=''; // how do i set it for dropdown box to reset after sucess? document.getElementById('val2').value=''; $('#val2').value=''; } Once user submit dropdown box, i need it to reset to value="" but now it sticks with user option even after submitted. Any idea how to achieve that?

    Read the article

  • how to hide the div which is inside an iframe?

    - by user2092317
    I want to hide a div which is inside a iframe , is there any way to hide a div by its attributes example: i have a iframe i need to hide the div id="content" content in php.net <iframe src="http://php.net/" id = 'iframe'> <div id="content">...</div> </iframe> Dont know where i am doing mistake, please help me to resolve this issue function hideIt(){ document.getElementById('iframe').contentWindow.document.getElementById('content').style.display = 'none'; }

    Read the article

  • Insert into textarea | JavaScript

    - by Wayne
    I'm trying to insert the image url where the point of the is to be when editing the textarea value. function addImageURL() { var imageurl = prompt("Enter image URL", "Your name") var post = document.getElementById("message-put").value; document.getElementById('message-put').value = post + '[img]' + imageurl + '[/img]'; } This code grabs the value inside the adds the image url next to it which I don't want, I need it to insert it where the point was when editing the textarea Thanks

    Read the article

  • textbox required equal false

    - by Donato bruno comunali F. dutra
    how do I make the textbox that required equal to false in this code $(document).ready(function () { $("#<%= chkSpecialIntegration.ClientID %>").click(function () { if (this.checked) { $("#<%= ddlTypeSpecialIntegration.ClientID %>").show(); document.getElementById('<%=txtTotalScoreDebit.ClientID %>').Required = false; } else{ $("#<%= ddlTypeSpecialIntegration.ClientID %>").hide(); document.getElementById('<%=txtTotalScoreDebit.ClientID %>').Required = true; } }); });

    Read the article

  • localStorage not working in IE9 and Firefox

    - by maha
    I am working with localStorage. My code is perfectly working in Chrome, but not in IE9 and Firefox. Here is the code: document.addEventListener("DOMContentLoaded", restoreContents, false); document.getElementsByTagName("body")[0].onclick=function(){saveContents('myList','contentMain', event, this);}; function amIclicked(e, eleObject) { alert("amIClicked"); e = e || event; var target = e.target || e.srcElement; alert("target = " + target.id); if(target.id=='pageBody' || target.id=='Save') return true; else return false; } function saveContents(e, d, eveObj, eleObject) { //alert("saveContents"); if (amIclicked(eveObj, eleObject)) { var cacheValue = document.getElementById(e).innerHTML; var cacheKey = "key_" + selectedKey; var storage = window.localStorage; //alert ("cacheKey = " + cacheKey + " ,cacheValue = " + cacheValue); if(typeof(Storage)!=="undifined"){ localStorage.setItem("cacheKey","cacheValue"); } //alert ("Saved!!"); var dd = document.getElementById(d); //document.getElementById("contentMain").style.display == "none"; dd.style.display = "none"; } } function restoreContents(e,k) { //alert("test"); if(k.length < 1) { return; } var mySavedList = localStorage["key_" + k]; if (mySavedList != undefined) { document.getElementById(e).innerHTML = mySavedList; } } <a onclick="ShowContent('contentMain','myList','Sample_1'); return true;" href="#" >Sample 1</a><br/><br/> <a onclick="ShowContent('contentMain','myList','Sample_2'); return true;" href="#" >Sample 2</a><br/><br/> <div style="display:none;display:none;position:absolute;border-style: solid;background-color: white;padding: 5px;"id="contentMain"> <ol id="myList" contenteditable="true"> <li>Enter Content here</li> </ol> <!--<input id="editToggleButton" type="button" value="Edit"/>--> </div> When I debugging in Iexplore Iam getting the error as SCRIPT5007: Unable to get value of the property 'length': object is null or undefined sample_1.html, line 157 character 3 Thanks

    Read the article

  • How to display an external content in my website using javascript

    - by Chris
    Hello! This is my first post! I have a question about javascript...here is my code: <html> <head> <title>Geolocation Demo</title> </head> <body> <h1>Geolocation Demo</h1> <p>Latitude: <span id="lat">0.00</span> Longitude: <span id="lon">0.00</span> City: <span id="city">Loading...</span></p> <p><a id="city_link" href="http://tinygeocoder.com/" target="_blank">View City</a></p> <p><a id="gmaps_link" href="http://maps.google.co.uk/" target="_blank">View on Google Maps</a></p> <script language="javascript"> // show the position on the page and make a google maps link function showPosition(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; document.getElementById("lat").innerHTML = lat; document.getElementById("lon").innerHTML = lon; var gmaps_url = "http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=" + lat + "+" + lon; var city_url = "http://tinygeocoder.com/create-api.php?g=" + lat + "," + lon; document.getElementById("gmaps_link").href = gmaps_url; document.getElementById("city_link").href = city_url; } </script> </body> </html> As you can see, this script target my geolocation. Specifically, Lat and Lon are working perfectly. In addinition, i want to display and region info (like city). So, i found a website which i provide the coordinates and it returns me a region name. My question is if i can display the name of region without clicking the link "View city" but in the field "city"...is it possible to pass the webpage content (http://tinygeocoder.com/create-api.php?g=" + lat + "," + lon;) into my webpage? The content of this page is only the name as i said...no html tags! Thank you!

    Read the article

  • is this correct syntax to create onclick event on dynamic html document

    - by user321382
    var val1=document.createElement("input"); val1.setAttribute('type',"image"); val1.setAttribute('src',"../images/delete.gif"); val1.setAttribute('id',chkid); val1.setAttribute('name',"val2"); val1.setAttribute('class',"mylist2"); val1.onclick=function(){var block=document.getElementById("repeat_ul"); var obj=document.getElementById('country_chk'); document.block.removeChild(obj);};

    Read the article

  • Resizing of AS-based Flash app from FireFox vs. IE...

    - by bferster
    I have put in some controls to allow users to resize my Flash app via Javascript: document.getElementById("flashApp").height*=1.25; document.getElementById("flashApp").width*=1.25; This works great in IE/Safari, but is ignored in Firefox. I know it's talking the the flash app and gets and sets the height/width vars ok, but the same code run in FireFox ignores the scaling. (It's not the DOC spec issue) Any thoughts? Bill

    Read the article

  • Javascript returns Nan in IE, FF ok

    - by user350184
    im very new to javascript, and writing this script to add up a shopping cart and print out subtotals and totals. it works in FF but not in IE. this function is called by onclick of one of three select options with a value of 0-25. it is in a js file called in the head. what it does is get the selected values as variables, parseint them, adds and multiplies, and changes the innerHTML of the table to reflect the subtotals, and total. FF does it great, but IE gives Nan. ive tried rewriting it a number of different ways, and many translations still work in FF but not IE8. ive made sure the variables and form id's arent repeated. function gen_invoice() { var scount = parseInt(document.shopcart.studentcount.value, 10); var ycount = parseInt(document.shopcart.youthcount.value, 10); var fcount = parseInt(document.shopcart.facultycount.value, 10); //html output source is 3 selects like this, with diff ids and names: //<select name="studentcount" id="studentcount"> //<option onclick="gen_invoice()" value="0">0 </option></select> var cardcost = parseInt(document.shopcart.cardprice.value, 10); //cardcost comes from hidden input value: //<input type="hidden" id="cardprice" name="cardprice" value="25"> var totalsum = scount + ycount + fcount; var grandtotal = totalsum * cardcost; document.getElementById('s_price').innerHTML = scount * cardcost; document.getElementById('y_price').innerHTML = ycount * cardcost; document.getElementById('f_price').innerHTML = fcount * cardcost; document.getElementById('grand').innerHTML = grandtotal; //.... } ...after this there are 3 long loops for writing out some other forms, but they dont work in IE either because they depend on the selected values to be an integer. this part happens first and returns Nan, so im sure the problem is here somwhere. I have literally hit my head on the table over this. You can imagine how frustrating it is to be able to write the entire rest of the site beautifully, but then fail at adding 3 numbers together. help please!

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >