Jump to content

nogray

Members
  • Posts

    930
  • Joined

  • Last visited

Everything posted by nogray

  1. You can't, cross domain scripting is not allowed for security reasons.
  2. change document.getElementByI['Introl_Image'] to document.getElementById('Introl_Image') use parentheses not brackets and missing D in the Id
  3. Your code is correct, probably you have something above it that is causing the error.
  4. <body onload="onload_iframe_height()"> Make sure to add the parentheses after the function name in the onload event
  5. function set_iframe_height(num){document.getElementById('my_iframe_id').style.height = num+'px';} Put that function in your main page (the page that host the iframe) and call it from the iframe using window.parent.set_iframe_height Both pages need to be in the same domain
  6. If the iframe and the page in the same domain, you can create a function in the main window to set the iframe height e.g. function set_iframe_height(num){ document.getElementById('my_iframe_id').style.height = num+'px'; } In your iframe page, you'll create an onload event that check the height and call the parent page function e.g. function onload_iframe_height(){ var h = Math.max( Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight) ); window.parent.set_iframe_height(h); } .... <body onload="onload_iframe_height" ... not tested
  7. When the user submit a question, you would need to loop through the current rows in your table and check the innerHTML for the questions td. If it's empty, populate it with the content. If all the rows are filled, add a new row.
  8. You have two errors, 1. is an undefined function in the submit button onclick="checkanswerserrors();" Just remove that 2. You can't have the name of a radio and the be the same (e.g. <input name="question1" id="question1"). Change your id to something different, like var question1_radio or q1...
  9. you can simply add an id to each checkbox and use document.getElementById e.g. <input type="checkbox" id="criteria_0" name.... /> <input type="checkbox" id="criteria_1" name.... /> ... for (boxnum=0; boxnum <= 12; boxnum++){ document.getElementById('criteria_'+boxnum).checked = true; }
  10. In the kid example, when you first click on the link, the if statment fails (if (kid.style.display == "block")) because it can't get the style, so the script goes to the else statment and show the menu. After you set the value once using javascript, you can access it later on. If you switch the if/else statments and check for none first, you would have to click twice at the begining to open the menu.
  11. When you try to access the style via object.style.property, the property has to be in an inline style (e.g. <ul style="display:none;">) or it has to be set via javascript before hand. If the property is in css class (or id), you need to search on how to get currentStyle properties. The other alternative to make your script easier is to remove the if statment. e.g. function closeSubLevel(){ document.getElementById('subLevel').style.display = 'none'; }
  12. Change the following function openSessionPopup (txt) { window.open(txt, 'window', 'width=500,height=500,scrollbars=yes,status=no'); } to window.open('MY_URL', 'window', 'width=500,height=500,scrollbars=yes,status=no');
  13. The easiest way to do this is just to make a static gif and an animated gif. When the user click the button change the image src to the animated gif. If you want to do it with javascript, you would create an array with all the frames (1,2,1,0) and loop through that array and replace the image for each frame var position = 0; var arr = ['img1.gif', 'img2.gif', 'img1.gif', 'img0.gif']; function dance(){ if (position >= arr.length) position = 0; document.getElementById('my_image_id').src = arr[position]; position++; } not tested
  14. You can't force a button to be pressed in javascript. However, there is an alternative for everything you asked for. Just google it (e.g. javascript copy to clipboard)
  15. You need to escape your single quotes onclick="pageTracker._trackEvent(\'Email\', \'Global\', \'Header Panel\');"
  16. <?php echo str_replace("'", "\\'", $height); ?> (not tested)
  17. You can't define a variable inside an object // <---------------------------------------------------------------------------------------- $('#nav_highlight').stop().animate({ // | var value = $(this).parent().get(0).id.substring(3) // move this line ouside the object -- left: $(value)
  18. So hosting companies don't provide json_encode() in php (even if they offer php 5.2+). I know it should be installed by default, but that's not the case all the times. Check if json_encode is avaliable using function_exists()
  19. normal textbox can't accept multi line text (you'll only get the first line), you can either seperate the names with a comma (or other character) or paste them into a textarea. For paste the data into different fields, you can simply add an onkeyup event to your field, split the value and populate the other fields.
  20. You can add the following newNode.getElementsByTagName('select')[0].name = 'new_name';
  21. The first click doesn't work because the events aren't added until the first click. Basiclly you're toggle function add events to the button. toggle will add a click event and process either first or second function. Buttons have the following status normal, mouseover, mousedown and checked or clicked if you want to highlight the clicked button. The best way to show the different status is to changing the class name with each event (e.g. button_normal, button_over, button_down, button_clicked)
  22. I think toggle adds a click event to your object and runs either function when the item is clicked. Why don't you just add the mousedown and mouseup events without the toggle.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.