Jump to content

Search the Community

Showing results for tags 'getelementbyid'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 6 results

  1. Hi, i make one but it will be many line same, like this with 20. document.getElementById("Test1").value = Dotoff; document.getElementById("Test2").value = Dotoff; document.getElementById("Test3").value = Dotoff; i wonder can it make all id in one? i tried it: document.getElementById("Test1","Test2","Test3").value = Dotoff; but it didn't work well, only Test1 change. some know how make all 20 in one? it can save me lots space/line ;)
  2. count_herout

    Changing Images on a Templated Page.

    I've a beginner's problem maybe someone can help with. Imagine a game simulating a sporting event (baseball, boxing, football, &c.). The games, themselves, are divided into time periods -- innings, rounds, quarters, &c. -- and one cannot know ahead of time how many periods actually will be played. So, for example, baseball is a nine-inning game -- unless there is rain or the need for extra innings if a tie; boxing is so many rounds -- unless there is a knockout or other fight-ending incident. The simulation addresses this within the game via a template -- the template describes with html what the presentation of one period -- inning, round, quarter, &c. -- will look like, and the simulation then simply calls the template for however many periods it needs to complete the contest. My problem (we'll use boxing hereafter) is that I want to install a different image (a round-card girl with card showing the correct round number) at the beginning of each round. My thinking so far is to create an array, var cardgirls=new Array(), with each of 15 girls occupying a slot in the array, cardgirls[0].src=../../images/RCG1.png, &c.; body onload = "Cardgirl(cardgirl1, cardgirls)"; &c. The difficulty is as follows: I can call for a specific card girl (one for all the rounds) by using <td id=img><img src = "../../images/RCG1.png, and the first card girl then will appear atop each round. HOWEVER, if I try to substitute a javascript function for the image source (to change the src code and get a different image) -- document.getElementById("cardgirl1).src=cardgirls[k].src (referring back to the array); body onload = "Cardgirl(cardgirl1, cardgirls);"...<td id="img"><img id = "cardgirl1">, &c. -- I can get the images to cycle in order, but they only appear for the first round (NO images appear for rounds 2 through end, only the alt, "Cardgirl"). For clarity, let me put it another way: The game is loading the "rounds" template ("innings" template -- whatever) for every round the game calls for and using an anchor tag to distinguish them [name=$$No.$$, so that each "round" template has "name=1; name=2; name=3, &c.]. If I use a general source for ONE of the images, img src="../../images/RCG1.png", that image will appear above ALL the rounds; BUT, if I call a javascript cycle function, the template tries to cycle ALL of the photos in the first round and installs NONE of them in rounds two to end, which remain blank save for the alt unless I also install a default image [src=../../images/RCG16.png, &c.]. I gather that, somehow, I need to link the image placement -- one per use of the template -- with the anchor ID, but so far my efforts to do that have not met with success. Nor was I successful when I relocated the javascript function from the general head to the end of the "rounds" template (on the assumption that, each time the template was used, it would call anew the cycle function). Anyone have any idea what I'm doing wrong? The relocation idea did get me the proper number of cycles, e.g., 7 for 7 rounds, but that just caused RCG1 to be the girl with card, Round 8, instead of Round 1 or Round 12 (what appears when the function is left in the head). Relocating does not move the image to the correct round.
  3. Hi, I need to use getElementById to reference to a div which contains a pic and without changing anything in the body tag, a random image slideshow should appear on load! instead of that pic. I have tried different ways to sort it out, but it was never perfect... Got 3 problems, first function changeDiv it says getElementsByTagname(...)[] is not defined... second is in the function rotateimage else document.images.splash undefined... third newimages function overwrites the whole page and it should only change the div anyone could help me out on this one?? Thanks 1.html
  4. Hey all, This will be easy for some of you but it's making me pull my hair out. Here is the relevant URL: http://www.neuverband.ch/index_TEMP.html I want to set the 'choose language' switch in the top right so that it will jump to the same page, in the chose language, as the one which is currently loaded... e.g. if the 'about-us' page is loaded and you switch language, rather than going back to the main page, it should go to 'about-us' in the new language. The site is organised in this way: page-name-in-English + _ + LANGUAGE + .html so, the possible URLs for 'about-us' are: about-us_EN.html about-us_DE.html about-us_FR.html about-us_IT.html As I see it, to do this, it's just a simple three-step process: 1. Store current iframe URL as variable 'X' - ALREADY DONE 2. Remove suffix _LANG from X and store as variable 'Y' - ALREADY DONE 3. set links in the 'choose-language-switch' to Y_EN, Y_DE, Y_FR & Y_IT - THIS PART IS WHAT I AM TRIPPING UP ON All of this will happen in the index_TEMP.html because the whole site displays with inline frames (id="mainframe"). PLEASE HELP! Paul
  5. Hello internet. I am having an issue with the following code working.CODE:<script type="text/javascript">window.onload = function() {for (var i = 0; i < Tload.length; i++){document.getElementById(Tload.id).value = Tload.value;}</script>The error code I am getting is:'docement.getElementById(…)' is null or not an object
  6. The following adapted code taken from this page works in firefox (and I assume some other browsers), but it does not work in internet explorer. The specific part, which stops the script entirely in IE is highlighted in red bold below. Is there a work around to solve this problem so that I can change the content of a style sheet dynamically - using onClick etc Thanks as always for your time. <html><head> <style id="poo" readonly=false>#myAnchor{color:green}</style><script type="text/javascript">function changeLink(){document.getElementById('poo').innerHTML="#myAnchor{color:red}"; document.getElementById('myAnchor').innerHTML="W3Schools";document.getElementById('myAnchor').href="http://www.w3schools.com";document.getElementById('myAnchor').target="_blank";}</script></head><body> <a id="myAnchor" href="http://www.microsoft.com">Microsoft</a><input type="button" onclick="changeLink()" value="Change link"> </body></html>
×