Change the src of an Iframe.


Hi ! I have the HTML source like this: And I tried to change the source of the iframe like this: document.frames.Content_IF.location.href = 'iframe.php'; or like this: document.Content_IF.location.href = 'iframe.php'; These 2 ways ...
Posted On: Friday 30th of November 2012 02:32:37 AM Total Views:  126
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




slide show fails when i change 'name' tag to 'id' so it is validated - JavaScript Help

I have checked the page via w3.org and it states that i need to change the 'name' tag to 'id' instead so I did but now my image slideshow does not work.JS /* Script by FPMC at http://jsarchive.8m.com Submitted to Javascript Kit (http://javascriptkit.com) For this and 400+ free scripts, visit http://javascriptkit.com */ src = ['../images/Intro1.jpg', '../images/Intro2.jpg', '../images/Intro3.jpg', '../images/Intro4.jpg', '../images/Intro5.jpg', '../images/Intro6.jpg', '../images/Intro7.jpg']; //set image paths // url = ['http://freewarejava.com', 'http://javascriptkit.com', 'http://dynamicdrive.com', 'http://www.geocities.com']; //set corresponding urls duration = 3; //set duration for each image //Please do not edit below ads=[]; ct=0; function switchAd() { var n=(ct+1)%src.length; if (ads[n] && (ads[n].complete || ads[n].complete==null)) { document['Intro_Image'].src = ads[ct=n].src; } ads[n=(ct+1)%src.length] = new Image; ads[n].src = src[n]; setTimeout('switchAd()',duration*1000); } the image tag What do I need to change in the JS so it works using the ID tag instead , w3 states i need to remove the name tag and replace with id, so i did but then the images do not change as i think the JS is looking for the name tag.what i can not see is where i change the JS code so it works for id instead of name tag , I used document.getElementById['Intro_Image'].src = ads[ct=n].src; But it does not change the image I did also change the name tag to id in the image , QuoteThat's not what I wrote. Always copy and paste.Quotedocument['Intro_Image']That line finds by name. You could just do:document.getElementByI('Introl_Image')Sorry I did copy and paste and changed the code slightly as I thought maybe there was a typo...But either way the image is not changing. , change document.getElementByI['Introl_Image'] to document.getElementById('Introl_Image') use parentheses not brackets and missing D in the Id
VIEWS ON THIS POST

72

Posted on:

Tuesday 27th November 2012
View Replies!

How to change smiley :) text to image in textarea - JavaScript Help

I have a code that will onclick, change a smiley face image to text in the textarea. When I click submit on the text area all it does is display the same text on my comment, not an image of smiley face. Here is the function.function insertSmiley(smiley) { var currentText = document.getElementById("comment"); var smileyWithPadding = " " + smiley + " "; currentText.value += smileyWithPadding; currentText.focus(); }And then the html. The code above works great to enter text into my textarea, but i also want it to convert to a image when I hit submit. I have read articles for about 3 days with no luck. The answer might be there but I am to dumb to know it. Thank you[attachment deleted by admin]
VIEWS ON THIS POST

93

Posted on:

Tuesday 27th November 2012
View Replies!

trying to change a background image for different devices - JavaScript Help

Trying to use a different sized image when a user comes in from an iphone instead of a regular computer screen. Have a secondary image uploaded, have the ability to check the screen size, and have a function call in my body tag's onload event. BUT - I'm getting the message "object doesn't support this property or method" when the js code executes. The offending line is: document.getElementByID('div_img').style.backgroundImage ='url(images/SunriseatThacher_IMG_3113_300x460.jpg)'; I've read everything I can find on the net and I dont' see what is wrong. I've tried different combos of quotes on the url portion and they didn't make a difference. The id name is correct - matches the div that I'm trying to alter. I think my capitalization is correct.Anyone
VIEWS ON THIS POST

231

Posted on:

Tuesday 27th November 2012
View Replies!

jumpmenu changes other jumpmenu - JavaScript Help

how can i make a simple bit of code that will allow me to have three jump menus, the first will be department where you select a department the second will be category then the three will be subcategory when i select the department i want it to change the second jumpmenu to display only categories in that department and when i select the category i want it to only display subcategories on the three jump menu in that category.
VIEWS ON THIS POST

89

Posted on:

Tuesday 27th November 2012
View Replies!

form only update change - JavaScript Help

Hi I got the js script below which loops through all form inputs , then check if the field value changes to other value rather than the default but for some reasons the if condition does not work, no error showed. Really need someone to shed a light on it. Maybe give me some other solutions to fulfil this task$(document).ready(function() { $("select").change(function(){ $("form").find("input").each(function(i) { if (this.value != this.defaulValue) { alert(this.value); } else { alert("no update"); \t\t } }); });
VIEWS ON THIS POST

117

Posted on:

Tuesday 27th November 2012
View Replies!

[jQuery] Slider that changes the font-size, little problem - JavaScript Help

,I had to make a slider bar to change the font-size of a website. The problem is:When I slide up, the text gets bigger, but when I slide down once, it gets bigger one more time before it starts getting smaller.When I slide down, the text gets smaller, but when I slide up once, it gets smaller one more time before it starts getting bigger.You know what I mean \t The text should really follow the slider value to get its size, but it doesn't because of this.Here is the code I use for the slider: $(document).ready(function() { //get current font-size var current_font_size=$("#texte").css("font-size"); //add to attribute "title" $( "#slider" ).attr("title",current_font_size); current_font_size=parseInt(current_font_size); //create slider $("#slider").slider({ value: current_font_size, //size at the start orientation: 'horizontal', min: 10, //minimum size max: 20, //maximum size slide: function(event, ui) { //on slide var value = $( "#slider" ).slider( "option", "value" ); //getting the new value $("#texte").css("font-size",value); //modify css $("#slider").attr("title",value.toString()+"px"); //adding title to the handle $(".size").html(value.toString()+"px"); //show the new size } }); });
VIEWS ON THIS POST

98

Posted on:

Tuesday 27th November 2012
View Replies!

element to change bgcolor - JavaScript Help

, trying to get a select element to change the background colour of my Div. However it doesn't work - it used to and i havn't changed anything. What is wrong
VIEWS ON THIS POST

131

Posted on:

Tuesday 27th November 2012
View Replies!

Onchange="form1.submit(); help keeps refreshing and losing data - JavaScript Help

I have got a registration form requiring usual, name, address, username, email etcLater on toward the end of the form it asks for country and then state. The country and states are stored in a database and the form queries the database for the states stored according to country. Trouble is that everytime I click on a country it refreshes the whole page and loses all the data that had been types in thus far...not only that but it doesn't select the state, just defaults back to please select a country.The coding relevant to the form reads below. Country :   State :   I am guessingt hat it has got to do with the submit perhaps being similar to the submit button that I use to post the form with\t However, this is really frustrating and holding me back. ANy help on this would be greatly appreciated. Many
VIEWS ON THIS POST

88

Posted on:

Tuesday 27th November 2012
View Replies!

A Button that changes images - JavaScript Help

Hi ! I have a major problem with the scripts that i found on this webpage. http://www.sislands....k3/onclick.htm This example is good. It points out what i would like to make but ... slightly different the "Change the image source" button . I played with it and tried to make it an image so it will look better but failed. I also tried to make it support more than 2 pictures but failed again :) ! If anyone could please clear a few things for me. When i added the
VIEWS ON THIS POST

221

Posted on:

Tuesday 27th November 2012
View Replies!

Jquery change function - JavaScript Help

not sure if I"m doing this correctly so seeing who can see or tell me if I'm doing this wrong. Say you chose an option from select box it would go into the events table and see that there's not been another event with that id so it'll return 1 and put it inside the text field called Label and when the user fills out the rest of the form it'll put 1 for the label field in the database table when the form is submitted then say the next week rolls around and the user clicks on that same option again and it goes to the events table and sees that there's an occurance of that show via the matching eventids and grabs all the labels with that matching eventid which at this point is only 1 so it would add 1 to that number and return 2 to the Label form text field.form page $('#eventid').change(function() { var eventid = $("select#eventid").val(); var dataString = 'eventid='+ eventid; $.ajax({ type: "POST", url: "processes/booking.php", data: eventid, success: function(data) { $('#label').append(data); } }); }); Select Event - Select - ** Recurring Events ** ** Singular Events ** ** Pay Per View Events ** Required Event Label Required processes/booking.php $eventid = (int)$_GET['eventid']; $result = mysqli_query("SELECT * FROM `events` WHERE `event_id` = '$eventid'"); $list = mysqli_num_rows($result); $label = $list + 1;
VIEWS ON THIS POST

172

Posted on:

Tuesday 27th November 2012
View Replies!

onfocus change fontsize of textarea - JavaScript Help

The font size is 28px. How do i change the font size to 12px onfocusi tried below but it isn't working. test
VIEWS ON THIS POST

303

Posted on:

Tuesday 27th November 2012
View Replies!

url change on else if doesn't work - JavaScript Help

Ok. I'm stumped. I have a dropdown from a form that passes a couple variables to a function that changes an image. It works just fine. But I quickly realized that if a user clicks again on the dropdown to change their option, the image link breaks because the url wasn't the same as I'd set up the code for. So I'm trying to put in a couple "else if" conditions to account for those, but it's not working. The url is still wrong. It's adding a folder to the filepath, but not deleting the one it should replace.Hope that made sense. Here's the code: function change3(picName,choice) { var url = (document[picName].src); if (/leaf_shapes\D{1}/.test(url)) { url = url.replace(/leaf_shapes/,"leaf_shapes/" + choice) document[picName].src=(url); } else if (/leaf_shapes\D{1}crenate/.test(url)) { url = url.replace(/leaf_shapes/crenate/,"/leaf_shapes/" + choice) document[picName].src=(url); } In case it helps, here's the dropdown that the information comes from: Entire Undulate Crenate Finely Serrate Serrate
VIEWS ON THIS POST

100

Posted on:

Tuesday 27th November 2012
View Replies!

how to: select onchange alter another field on same page - JavaScript Help

I have a multiple fields on my page and wish to have a reusable javascript to update the previous box with the selction made.how would this be done 1 2 3         1 2 3  
VIEWS ON THIS POST

122

Posted on:

Tuesday 27th November 2012
View Replies!

jquery - change height of dynamically added div - JavaScript Help

I'm trying to set the height of a div that gets added after a ajax call...I thought this code would work but it's failing... //set height of datagrid var gridheight = $(window).height() * .95; $('#datagrid').css("height", gridheight); the div is generated in this code... ... //build table/grid $tablecode = "App Need"; $tablecode .= "Requestor"; $tablecode .= "Category"; $tablecode .= "Description"; $tablecode .= ""; $r=0; foreach($tabledata as $itemdata) { $r++; $itemid = $itemdata['id']; $itemname = $itemdata['wish']; $itemdesc = $itemdata['description']; $itemrequestor = $itemdata['requestor']; $itemcat = $itemdata['category']; $tablecode .= " " . $itemname . " " . $itemrequestor . " " . $itemcat . " " . $itemdesc . ""; } $tablecode .= ""; ... any idea why I can't target that div
VIEWS ON THIS POST

110

Posted on:

Tuesday 27th November 2012
View Replies!

Function to change font color if number is negative

I have a function that does some calculations and populates some text fields with the results. I also have a function that changes the font color of the numbers to red if they are less than zero. What I dont have is a way to make them work together. I imagine I need to pass the results of the calculation function to the change color function, but not sure how to go about doing that. Any and helpful hints or tutorial links ould be appreciated. Here is the calculation function: // function to calculate the total costs, gain/loss and return percent. function calculate() { // Declare variables for use in calculation var contractsAdded = document.forms[0].contractsAdded.value; var priceAdded = document.forms[0].priceAdded.value; var contractsSold = document.forms[0].contractsSold.value; var priceSold = document.forms[0].priceSold.value; // Calculate totals and assign to new variables var totalAdded = (contractsAdded * priceAdded) * 100; var totalSold = (contractsSold * priceSold) * 100; var gainLoss = totalSold - totalAdded; var percent = gainLoss / totalAdded; // Populate the form fields with the results document.forms[0].totalAddedCost.value = totalAdded; document.forms[0].totalSoldCost.value = totalSold; document.forms[0].gainLoss.value = gainLoss; document.forms[0].returnPercent.value = percent; } And here is the change color function: // function to change font color to red for negative numbers. function changeColor() { if (totalAdded < 0) { document.getElementsByName("totalAddedCost").style.color="#ff0000"; } else if (totalSold < 0) { document.getElementsByName("totalSoldCost").style.color="#ff0000"; } else if (gainLoss < 0) { document.getElementsByName("gainLoss").style.color="#ff0000"; } else if (percent < 0) { document.getElementsByName("returnPercent").style.color="#ff0000"; } }
VIEWS ON THIS POST

97

Posted on:

Thursday 29th November 2012
View Replies!

Replacing a regex match with changed matched results.

I was trying to do something similar to code highlighting but can't find a good way to do it. For example lets take this code: def some_function(): something() somethingElse() def some_other_function(): something2() somethingElse2() Now it is easy to find and replace constant words like def with something like this: string = string.replace(/def\s/gi, "def "); But what if i want to make functions bold I wan't to find a way to send the current match as a second parameter(ofcurse changed). Something like: chg = chg.replace(/\w+\(\):/gi, "" + matched_string + ""); How can i do this
VIEWS ON THIS POST

107

Posted on:

Thursday 29th November 2012
View Replies!

Replacing a regex match with changed matched results.

I was trying to do something similar to code highlighting but can't find a good way to do it. For example lets take this code: def some_function(): something() somethingElse() def some_other_function(): something2() somethingElse2() Now it is easy to find and replace constant words like def with something like this: string = string.replace(/def\s/gi, "def "); But what if i want to make functions bold I wan't to find a way to send the current match as a second parameter(ofcurse changed). Something like: chg = chg.replace(/\w+\(\):/gi, "" + matched_string + ""); How can i do this
VIEWS ON THIS POST

98

Posted on:

Thursday 29th November 2012
View Replies!

Can I change a p into a textarea?

Hi... I've seen code which changes a paragraph into a textarea (to allow it to be edited)...by creating a brand new text area, inserting that into the dom at the right place, and deleting the paragraph from the dom. I.e. ...
VIEWS ON THIS POST

157

Posted on:

Friday 30th November 2012
View Replies!

With YYYYMMDD Trying to change MM to August

I am new to javascript. What I would like is to change the value of a month in MM format into the months proper name. This is the code.
VIEWS ON THIS POST

96

Posted on:

Friday 30th November 2012
View Replies!

FAQ Topic - How do I change print settings with window.print()? (2008-01-02)

----------------------------------------------------------------------- FAQ Topic - How do I change print settings with window.print() ----------------------------------------------------------------------- In a normal security environment, you can't change anything. The page stylesheet rules provide some options, but are not supported in browsers yet. If you can, use ...
VIEWS ON THIS POST

133

Posted on:

Friday 30th November 2012
View Replies!