nogray
Members-
Posts
930 -
Joined
-
Last visited
Everything posted by nogray
-
You can't, cross domain scripting is not allowed for security reasons.
-
slide show fails when i change 'name' tag to 'id' so it is validated
nogray replied to jasonc's topic in Javascript Help
change document.getElementByI['Introl_Image'] to document.getElementById('Introl_Image') use parentheses not brackets and missing D in the Id -
Your code is correct, probably you have something above it that is causing the error.
-
<body onload="onload_iframe_height()"> Make sure to add the parentheses after the function name in the onload event
-
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
-
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
-
table adds rows in all browsers except for Internet Explorer
nogray replied to carlbrooks's topic in Javascript Help
Are you inserting the row into the table or the tbody -
Table creates new rows when a question is submitted
nogray replied to carlbrooks's topic in Javascript Help
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. -
-
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...
-
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; }
-
What is the difference between these two examples?
nogray replied to Frank P's topic in Javascript Help
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. -
What is the difference between these two examples?
nogray replied to Frank P's topic in Javascript Help
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'; } -
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');
-
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
-
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)
-
Add Analytics into generated email link with document.write
nogray replied to jarvis's topic in Javascript Help
You need to escape your single quotes onclick="pageTracker._trackEvent(\'Email\', \'Global\', \'Header Panel\');" -
<?php echo str_replace("'", "\\'", $height); ?> (not tested)
-
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)
-
Uncaught TypeError: Cannot read property 'address' of null
nogray replied to fishbaitfood's topic in Javascript Help
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() -
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.
-
You can add the following newNode.getElementsByTagName('select')[0].name = 'new_name';
-
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)