garethhall Posted March 4, 2010 Share Posted March 4, 2010 Hello I want to create an iframe and then target it. The frame creation part is working but I can't seem to target it Please help function getFile(fileID,compID){ var theFrame = document.createElement('iframe'); theFrame.setAttribute('name','theDload'+fileID); theFrame.setAttribute('width','100'); theFrame.setAttribute('height','100'); theFrame.setAttribute('id','theDload'+fileID); document.getElementById('theDFrame').appendChild(theFrame); theDload[fileID].location = './main.php?fileID='+fileID+'&compID='+compID; // problem on this line???? } Link to comment https://forums.phpfreaks.com/topic/194087-dynamic-frame-and-targeting/ Share on other sites More sharing options...
roopurt18 Posted March 4, 2010 Share Posted March 4, 2010 Do you receive a JavaScript error? Does it attempt to load anything? What exactly is the problem? Link to comment https://forums.phpfreaks.com/topic/194087-dynamic-frame-and-targeting/#findComment-1021618 Share on other sites More sharing options...
garethhall Posted March 4, 2010 Author Share Posted March 4, 2010 The error is: Result of expression 'theDload[fileID]' [undefined] in not an object Link to comment https://forums.phpfreaks.com/topic/194087-dynamic-frame-and-targeting/#findComment-1021621 Share on other sites More sharing options...
roopurt18 Posted March 4, 2010 Share Posted March 4, 2010 You're trying to set the location of the iframe, right? Why aren't you using the variable theFrame? Link to comment https://forums.phpfreaks.com/topic/194087-dynamic-frame-and-targeting/#findComment-1021623 Share on other sites More sharing options...
garethhall Posted March 4, 2010 Author Share Posted March 4, 2010 Well theFrame is the created element right? and not the name element. I updated the code and now get this error 'INVALID_STATE_ERR: DOM Exception 11' theFrame.location = './main.php?fileID='+fileID+'&compID='+compID; Link to comment https://forums.phpfreaks.com/topic/194087-dynamic-frame-and-targeting/#findComment-1021671 Share on other sites More sharing options...
Dennis1986 Posted March 4, 2010 Share Posted March 4, 2010 function getFile(fileID,compID){ var theFrame = document.createElement('iframe'); theFrame.setAttribute('name','theDload'+fileID); theFrame.setAttribute('width','100'); theFrame.setAttribute('height','100'); theFrame.setAttribute('id','theDload'+fileID); document.getElementById('theDFrame').appendChild(theFrame); theFrame.setAttribute('src', './main.php?fileID='+fileID+'&compID='+compID); } Link to comment https://forums.phpfreaks.com/topic/194087-dynamic-frame-and-targeting/#findComment-1021681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.