Ashish
Ashish

Reputation: 1567

how to set href value at runtime through javascript?

i have created a html page which contain two iframe .

first iframe refer another html which contain a list of members this list is not fixed and every member name there is a separate html page. which is shown by second iframe.

i have written some javascript code to get the value of that list but i am unable to update the src link of second iframe.

document.getElementById("frame2").setAttribute("src", name);

i have used this code to set the value but i didn't work. i have written this code in javascript file in setFileName(name) function.this is user define function.

Upvotes: 0

Views: 2199

Answers (3)

Ashish
Ashish

Reputation: 1567

i got my answer

top.parent.frame2.location = name;

like this we can change the src of another frame.

thanks all of you..

Upvotes: 0

Anil Namde
Anil Namde

Reputation: 6608

I have faced this query once and following article helped me. Hopefully it will be useful to resolve your issue.

http://www.dyn-web.com/tutorials/iframes/

Upvotes: 0

Patrick
Patrick

Reputation: 7712

might want to give this a try:

window.frames["frame2"].src = name

Information from: Changing Iframe source using Javascript

Upvotes: 1

Related Questions