user2176150
user2176150

Reputation: 303

Load iframe src using javascript

I am using the below code to load the iframe src for the parent iframe. But its not working for me.

  var cur_iframeid = frameElement.id;
  alert(cur_iframeid);//Parent iframe id 
  var value = "activity.aspx?id=Y&cust_id=" + cust_id + "&role_id=" + role +";
  alert(value);
  cur_iframeid.src = value;//Its not working.

Upvotes: 2

Views: 3751

Answers (2)

Michiel
Michiel

Reputation: 4260

You are trying to set the source of the frame id. I think you need to set the source of the frame:

frameElement.src = value

Upvotes: 1

Dory Zidon
Dory Zidon

Reputation: 10719

seems you are tring to set the source on the frameelement id..not the frame elements... try either:

frameElement.src = value

or

document.getElementById(cur_iframeid).src = value

Upvotes: 2

Related Questions